Description
Operating system: Windows Server 2008 R2
MySQL version: 5.5.25a
MySQL Program installation directory: D:\Program files\mysql\mysql Server 5.5
MySQL database default directory: C:\ProgramData\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-cmd
net stop mysql55
Second, copy the original database 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 C:\ProgramData\MySQL\MySQL Server 5.5\ to
D:\Program files\mysql\mysql Server 5.5\ Directory
System Yun-wei www.osyunwei.com warm reminder: qihang01 original content copyright, reproduced please indicate the source and the original link
Third, modify the MySQL configuration file
1, with Notepad to open the C:\ProgramData\MySQL\MySQL Server 5.5\data\ directory My.ini
Find datadir= "C:\ProgramData\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 modification 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-cmd
net start mysql55
2, into the MySQL console
Start-All Programs-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 2008 R2 to modify the MySQL 5.5 database directory complete