作者:傻a2602909381 | 来源:互联网 | 2017-05-12 16:11
win2008 R2服务器下修改MySQL 5.5数据库data目录的方法_MySQL说明:
操作系统:Windows Server 2008 R2
MySQL版本:5.5.25a
MySQL程序安装目录:D:\Program Files\MySQL\MySQL Server 5.5
MySQL数据库默认目录:C:\ProgramData\MySQL\MySQL Server 5.5\data\
需求:修改MySQL数据库目录为D:\Program Files\MySQL\MySQL Server 5.5\data
具体操作:
一、停止MySQL
开始-cmd
net stop mysql55

二、复制原来数据库目录到新目录
1、备份D:\Program Files\MySQL\MySQL Server 5.5\中的data目录为data-bak
2、复制C:\ProgramData\MySQL\MySQL Server 5.5\中的data目录到
D:\Program Files\MySQL\MySQL Server 5.5\目录下
系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容版权所有,转载请注明出处及原文链接

三、修改MySQL配置文件
1、用记事本打开C:\ProgramData\MySQL\MySQL Server 5.5\data\目录下的my.ini
找到datadir="C:\ProgramData\MySQL\MySQL Server 5.5\data"
在前面加#注释掉
在下面添加一行
datadir="D:\Program Files\MySQL\MySQL Server 5.5\data"
修改完成后,保存退出。

2、复制C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.5\目录下的my.ini到
D:\Program Files\MySQL\MySQL Server 5.5\目录下

四、重新启动MySQL
1、开始-cmd
net start mysql55

2、进入MySQL控制台
开始-所有程序-MySQL-MySQL Server 5.5-MySQL 5.5 Command Line Client
提示输入MySQL root账号的密码,输入之后回车,进入MySQL控制台
show variables like '%datadir%'; #查询MySQL数据库存放目录,如下图所示

可以看到MySQL数据库存放目录已经修改为D:\Program Files\MySQL\MySQL Server 5.5\data
至此,Windows Server 2008 R2下修改MySQL 5.5数据库目录完成
以上就是win2008 R2服务器下修改MySQL 5.5数据库data目录的方法_MySQL的内容,更多相关内容请关注PHP中文网(www.php1.cn)!