[mythtv-users] Moving my mysql database to another drive

Ramin K ramin-list at badapple.net
Mon Jan 24 19:01:24 UTC 2011


On 1/22/2011 10:12 PM, Michael Rice wrote:
> I am having some problems that may be related to disk performance.
> (See http://www.mythtv.org/pipermail/mythtv-dev/2011-January/070387.html).
> I have an extra drive and I am thinking about moving the database to it
> to see if it helps the situation.
>
> If anyone has pointers/gotchas on doing this (especially on Fedora)
> I'd appreciate hearing about them.  Is there any particular way I
> should format the drive to help performance?

The simplest and most foolproof method would be:

sudo service mysqld stop
sudo rsync -av /var/lib/mysql/ /path/to/new/mysql/

edit /etc/my.cnf and change the datadir to a new path. Add the socket 
for your client so it doesn't use the default 
/var/lib/mysql/mysql.socket to connect to the server locally.

[client]
socket=/var/lib/mysql1/mysql.sock

[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock

datadir=/path/to/new/mysql
socket=/path/to/new/mysql/mysql.sock

sudo service mysqld start

Don't delete the old mysql directory until you're sure it works. I 
notice in my Fedora14 VM that symlinks are turned off in my.cnf. You'd 
need to comment that line out if you decide to symlink the old location 
to the new instead of changing the datadir.

Ramin


More information about the mythtv-users mailing list