Specific steps to change the location of the Mysql database storage

  • 2020-05-30 21:12:04
  • OfStack

1. First of all, stop the service of mysql.

2. Change the database storage main path in the MySQL configuration file My.ini

Open the my.ini file in MySQL default installation folder C:\Program Files\MySQL\MySQL Server 5.1, click "edit" and "find" at the top of notepad, enter datadir in the search content and click "find the next one" to go to "Path to the database root database storage main path" parameter setting, Find datadir="C:/Documents and Settings/All Users/Application Data/MySQL MySQL/MySQL data /" which is the default database storage main path setting. Now change it to C:\mysql\data (you want) folder. The correct setting is datadir="C:/mysql/data/".

Click "file" in the menu bar after completing the changes, and then click "save".

3. Copy the database files and folders from the old database storage main path to the new one

Copy all the files and folders in the C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/ folder into the directory you created.

4. Restart MySQL service

5. Verify that the operation to change the main path of the database store was successful

Related articles: