<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://techwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=Move_MySQL_to_Home_Partition</id>
	<title>Move MySQL to Home Partition - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://techwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=Move_MySQL_to_Home_Partition"/>
	<link rel="alternate" type="text/html" href="http://techwiki.co.uk/index.php?title=Move_MySQL_to_Home_Partition&amp;action=history"/>
	<updated>2026-05-17T15:05:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>http://techwiki.co.uk/index.php?title=Move_MySQL_to_Home_Partition&amp;diff=99&amp;oldid=prev</id>
		<title>Adam.birds: Created page with &quot;To move MySQL from '''/var/lib/mysql''' to '''/home/mysql''' please do the following:  Use the following command to stop MySQL:  &lt;pre&gt; service mysqld stop &lt;/pre&gt;  Use the foll...&quot;</title>
		<link rel="alternate" type="text/html" href="http://techwiki.co.uk/index.php?title=Move_MySQL_to_Home_Partition&amp;diff=99&amp;oldid=prev"/>
		<updated>2016-04-28T10:53:15Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;To move MySQL from &amp;#039;&amp;#039;&amp;#039;/var/lib/mysql&amp;#039;&amp;#039;&amp;#039; to &amp;#039;&amp;#039;&amp;#039;/home/mysql&amp;#039;&amp;#039;&amp;#039; please do the following:  Use the following command to stop MySQL:  &amp;lt;pre&amp;gt; service mysqld stop &amp;lt;/pre&amp;gt;  Use the foll...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;To move MySQL from '''/var/lib/mysql''' to '''/home/mysql''' please do the following:&lt;br /&gt;
&lt;br /&gt;
Use the following command to stop MySQL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service mysqld stop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the following command to edit the MySQL Config File:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vi /etc/my.cnf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then change the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
datadir=/var/lib/mysql&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
datadir=/home/mysql&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then use the following command to make the '''/home/mysql''' directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir /home/mysql&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then set the ownership of this directory using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chown mysql:mysql /home/mysql&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then move the MySQL files using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /var/lib/mysql/* /home/mysql/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the following command to restart MySQL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service mysqld restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then perform a '''mysqlcheck''' using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysqlcheck –Ar&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wait for this to finish and it should be fine.&lt;br /&gt;
&lt;br /&gt;
If this is done on a backup server perform the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service bacula-sd restart&lt;br /&gt;
service bacula-fd restart&lt;br /&gt;
service bacula-dir restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:MySQL]]&lt;br /&gt;
[[Category:Bacula]]&lt;br /&gt;
[[Category:Backups]]&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:Contents]]&lt;/div&gt;</summary>
		<author><name>Adam.birds</name></author>
		
	</entry>
</feed>