- 时间:2021-11-27 15:36 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:Windows Server 2003下修改MySQL 5.5数据库data目录
[img]http://files.jb51.net/file_images/article/201604/201604152315075.jpg[/img]
[b]说明:[/b]
操作系统:Windows Server 2003
MySQL版本:5.5.25
MySQL程序安装目录:D:\Program Files\MySQL\MySQL Server 5.5\
MySQL数据库目录:C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.5\data
[b]需求:[/b]修改MySQL数据库目录为D:\Program Files\MySQL\MySQL Server 5.5\data
[b]具体操作:[/b]
[b]一、停止MySQL[/b]
开始-运行-cmd
net stop mysql55
[img]http://files.jb51.net/file_images/article/201604/201604152315086.jpg[/img]
[b]二、复制原来数据库存放目录到新目录[/b]
1、备份D:\Program Files\MySQL\MySQL Server 5.5\中的data目录为data-bak
2、复制C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.5\中的data目录到
D:\Program Files\MySQL\MySQL Server 5.5\目录下
[img]http://files.jb51.net/file_images/article/201604/201604152315087.jpg[/img]
[b]三、修改MySQL配置文件[/b]
1、用记事本打开C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.5\目录下
my.ini
找到datadir="C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.5\data\"
在前面加#注释掉,
再下面添加一行datadir="D:\Program Files\MySQL\MySQL Server 5.5\data"
改完成后,保存退出。
[img]http://files.jb51.net/file_images/article/201604/201604152315088.jpg[/img]
2、复制C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.5\目录下的my.ini到
D:\Program Files\MySQL\MySQL Server 5.5\目录下
[img]http://files.jb51.net/file_images/article/201604/201604152315089.jpg[/img]
[b]四、重新启动MySQL[/b]
1、开始-运行-cmd
net start mysql55
[img]http://files.jb51.net/file_images/article/201604/2016041523150810.jpg[/img]
2、进入MySQL控制台
开始-程序-MySQL-MySQL Server 5.5-MySQL 5.5 Command Line Client
[img]http://files.jb51.net/file_images/article/201604/2016041523150811.jpg[/img]
提示输入MySQL root账号的密码,输入之后回车,进入MySQL控制台
show variables like '%datadir%'; #查询MySQL数据库存放目录,如下图所示
[img]http://files.jb51.net/file_images/article/201604/2016041523150912.jpg[/img]
可以看到MySQL数据库存放目录已经修改为D:\Program Files\MySQL\MySQL Server 5.5\data
[b]至此,Windows Server 2003下修改MySQL 5.5数据库目录完成[/b]