{"id":369,"date":"2010-09-11T02:02:32","date_gmt":"2010-09-11T08:02:32","guid":{"rendered":"http:\/\/blog.supportpro.com\/2010\/09\/change-mysql-data-directory\/"},"modified":"2018-10-04T06:30:28","modified_gmt":"2018-10-04T12:30:28","slug":"change-mysql-data-directory","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/change-mysql-data-directory\/","title":{"rendered":"Change mysql data directory"},"content":{"rendered":"<p>The default location is \/var\/lib\/mysql<br \/>\nYou can change mysql data directory by adding the following entries in \/etc\/my.cnf file<br \/>\ndatadir=newlocation\/path<br \/>\nsave the file, move the necessary database files from \/var\/lib\/mysql to the new location and restart mysql.<\/p>\n<p>&nbsp;<\/p>\n<p><!--more--><\/p>\n<p>To check if the new location is added correctly, login to mysql as root and create a test database and check the new location if the new database files are added or not.<br \/>\nIf mysql doesnt start after restarting then check the logs for an error<br \/>\n# tail -f \/var\/log\/mysqld.log<br \/>\nIf there are no specific errors mentioned check if selinux is enabled or not. If its enabled then you may disable it and try starting mysql.<br \/>\ncommands to check if selinux is enabled<br \/>\n#getenforce<br \/>\nthe result will be like enabled, permissive or targeted You can disable it by editing the configuration file \/etc\/selinux\/config (RHEL\/centos)<\/p>\n<p>If you require help, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\">contact SupportPRO Server Admin<\/a><\/p>\n<p style=\"text-align: center;\"><!--HubSpot Call-to-Action Code --><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><!-- [if lte IE 8]><\/p>\n\n\n\n\n\n<div id=\"hs-cta-ie-element\"><\/div>\n\n\n<![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b\"><img decoding=\"async\" id=\"hs-cta-img-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-img\" style=\"border-width: 0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b.png\" alt=\"Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value\" \/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '9d590242-d641-4383-94b4-8cfd62f0af6b', {}); <\/script><\/span><!-- end HubSpot Call-to-Action Code --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The default location is \/var\/lib\/mysql You can change mysql data directory by adding the following entries in \/etc\/my.cnf file datadir=newlocation\/path save the file, move the necessary database files from \/var\/lib\/mysql&hellip;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-369","post","type-post","status-publish","format-standard","hentry","category-miscellaneous"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=369"}],"version-history":[{"count":1,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/369\/revisions"}],"predecessor-version":[{"id":3375,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/369\/revisions\/3375"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}