1. Stop mysql services first.
2. Change the master path of database storage in MySQL configuration file My. ini
Open the default MySQL installation folder C: \ Program Files \ MySQL Server 5.1 In my. INI file, click "edit" and "Search" at the top of the notepad ", enter datadir in the search content and click "find next" to go to "Path to the database root database storage master Path" parameter settings, find datadir = "C: /Documents and Settings/All Users/Application Data/MySQL Server 5.1/Data/"is the default database storage master path setting, which is now changed to C: \ mysql \ data (what you want) folder. The correct setting is datadir = "C:/mysql/data /".
After the changes are completed, click "file" in the menu bar and then click "save ".
3. Copy the database files and folders in the master path of the old database storage to the new master path.
Copy All the files and folders in the C:/Documents and Settings/All Users/Application Data/MySQL Server 5.1/Data/folder to the folder you created.
4. Restart the MySQL Service
5. Verify that the operation to change the primary path of the database is successful