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

更改默认的mysql数据库目录

将 C:Documents and SettingsAll UsersApplication DataMySQLMySQL Server 5.1data 改到 D:MysqlData

1. 建立文件夹 D:MysqlData

2. 停止 mysql 服务,将 "C:Documents and SettingsAll UsersApplication DataMySQLMySQL Server 5.1data" 所有文件,拷贝到 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:ProgramDataMySQLMySQL Server 5.7My.ini

C:ProgramDataMySQLMySQL Server 5.7Data

原文地址:https://www.cnblogs.com/ilookbo/p/5763527.html