Description
Operating system: Windows Server 2003
MySQL version: 5.5.25
MySQL Program installation directory: D:\Program files\mysql\mysql Server 5.5\
MySQL Database directory: C:\Documents and Settings\All Users\Application Data\mysql\mysql Server 5.5\data
Requirements: modify MySQL database directory for D:\Program files\mysql\mysql Server 5.5\data
Specific actions:
First, stop MySQL
Start-run-cmd
net stop mysql55
Second, copy the original database storage directory to the new directory
1, backup D:\Program files\mysql\mysql Server 5.5\ in the data directory for Data-bak
2. Copy the Data directory in the C:\Documents and Settings\All Users\Application Data\mysql\mysql Server 5.5\ to
D:\Program files\mysql\mysql Server 5.5\ Directory
Third, modify the MySQL configuration file
1, with Notepad open C:\Documents and Settings\All Users\Application Data\mysql\mysql Server 5.5\ Directory
My.ini
Find Datadir= "C:\Documents and Settings\All Users\Application Data\mysql\mysql Server 5.5\data\"
In front add # comment out,
Add a row below datadir= "D:\Program files\mysql\mysql Server 5.5\data"
After the change is complete, save the exit.
2. Copy 5.5\ to C:\Documents and Settings\All Users\Application Data\mysql\mysql Server My.ini Directory
D:\Program files\mysql\mysql Server 5.5\ Directory
Four, restart MySQL
1, start-run-cmd
net start mysql55
2, into the MySQL console
Start-Program-mysql-mysql Server 5.5-mysql 5.5 Command line Client
Prompts to enter the MySQL root account password, enter after entering the MySQL console
Show variables like '%datadir% '; #查询MySQL数据库存放目录, as shown in the following figure
You can see that the MySQL database repository directory has been modified to D:\Program files\mysql\mysql Server 5.5\data
At this point, Windows Server 2003 modifies the MySQL 5.5 database directory to complete