Windows下更改MySQL 数据库文件存放位置

更改默认的mysql数据库目录

将 C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data 改到 D:\MysqlData

1. 建立文件夹 D:\MysqlData

2. 停止 mysql 服务,将 "C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data" 所有文件,拷贝到 D:\MysqlData

3. 在 mysql 安装目录找到 my.ini文件,找到:

#Path to the database root
#datadir="C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/"

将datadir的值改为:  datadir="D:/MysqlData/"

保存后,重新启动mySQL服务即可。

 

C:\ProgramData\MySQL\MySQL Server 5.7\My.ini

C:\ProgramData\MySQL\MySQL Server 5.7\Data

 

posted @ 2016-08-12 08:05  bobo-bobo  阅读(3120)  评论(0编辑  收藏  举报