Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Transferring MySQL Data between drives !!


From: "Louis Selvon"
Sent: Monday, May 19, 2003 10:54 PM
>
> To fix the problem a fresh restore was required by the support staff on a
new
> drive.
>
> They have mounted my original drive with all the data on a slave drive.
>
> I have never transferred MySQL data between drives. Can anyone tell me how
to
> go about this, or point me to some url that may help on this ?
>

Depending on whether you are MySQL user or DB Administrator.

As user, there is a file called '.my.cnf' in your home directory.

1. Look for a line  that says '[mysqld]'.
2. One of the lines that follows this line starts with 'datadir = .......'.

For example,

datadir = /var/mysql

Change this line to point to the new directory, for example

datadir = /usr/local/mysql

assuming this is the new directory.

Stop/Restart your mysql application.

As DB Administrator, look for global 'my.cnf' usually in '/etc/'.

Change the 'datadir = ...' parametner accordingly and advise all
your users to examine if they have their own local 'my.cnf' and
change accordingly.

In your 'my.conf' you may have to change  your log files, too.

Ensure your file permissions in your new directory is
readeable and writable by the owner of your databases,
usually 'mysql'.

Stop/Restart your mysql daemon.

Then, RTFM (Read the fine manual) documentation found at www.mysql.com.

Good luck.