Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm using MySQL 5.5 on a local machine to analyze a large amount of government data. I've created a local database that resides on my default drive (Win7 C: drive). I'd like to store the data on my E: drive, a large eSATA external drive.

What steps should I take?

share|improve this question
    
cant you export the dB as a sql file, then save the file do e: then in the future if you want to restore the dB you can import this file –  t q Mar 1 '12 at 19:03
    
@tq - That won't work. He wants to change the MySQL server data directory. If he exports it and imports it, it'll still be on the same drive! –  Flukey Mar 1 '12 at 19:06
    
A word of caution when you move the database files to the external drive, you will have to keep it plugged into your computer otherwise your database will crash since it will not be able to find the data files –  ssmusoke Mar 1 '12 at 19:36
add comment

migrated from stackoverflow.com Mar 3 '12 at 1:52

This question came from our site for professional and enthusiast programmers.

2 Answers

  1. Shutdown mysql.
  2. Move all the files in your current data directory to the new location (check out the location in step 3 - datadir parameter).
  3. Locate my.ini file (it is in the mysql installation directory). Change datadir parameter value to point to the new location.
  4. Start mysql.
share|improve this answer
add comment

Solution 1:

1, First of all, backup your data using mysqldump.
2, If you install Mysql Server from official package, you can do it by running program MySQLINstanceConfig.exe from bin directory of your server.
3, Import data

MySQLINstanceConfig.exe

Second solution (not recommended, but works on same machine)

1, Stop Mysql server.
2, Copy data from your data directory to your new directory
3, Open my.cnf file (In my case "C:\ProgramData\MySQL\MySQL Server 5.5\my.ini")
4, find row like datadir="C:\ProgramData\MySQL\MySQL Server 5.5\data\" and change path to your new location
5, Start your server
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.