Help - Search - Members - Calendar
Full Version: move mysql db
The Planet Forums > System Administration > General Support Questions
Scrumpy
Can someone please tell me how to move a db from one hard drive to another. It was necessary for a restore but I need to move a db from our old hard drive to the new one within 48 hours.

I have the drive mounted, I can see the db but everything I've tried has failed. rolleyes.gif

Help?
dynamicnet
Happy Thanksgiving Scrumpy:

Presuming the new hard drive replaces the old hard drive, and the server will use this new hd as its base (boot, os) drive, then:

1. Make sure you have mysql on the new drive.

2. With the database server application stopped, copy the files over with "cp"

The database files are typically in /usr/local/mysql/var or the data directory.

If this fails, it would help in your posts if you are specific as to what you tried that failed.

Thank you.
Scrumpy
Thanks for the advice and Happy Thanksgiving.

I'm at work right now - lucky me icon_sad.gif but I will try your suggestion asap.

The second hard drive is only temp, ev1 is giving me a chance to retreive some data before removal.

Will this method copy the db completly? What I've tried to do is a mysqldump from the second drive /mnt/olddisk/var/lib/mysql - but I keep getting access denied errors or unknown db error. I've tried every combo of user / password and nothing works. I have limited experience with moving files around in linux.

I thought I could dump the db and then restore :confused:

Thanks again for the help, have a great Thanksgiving.
dynamicnet
Greetings:

Once you have mySQL installed on the new drive, you could do take the mysql dumps of your database and import them in.

You would also have to update the mysql database for the user and database rights.

Thank you.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.