Windows下移动MariaDB数据目录:
http://www.xue163.com/news/940/9403312.html
【环境】OS:Windows Server 2008 R2 x64
MariaDB:10.0.15-MariaDB; 安装目录为C:Program FilesMariaDB 10.0
【步骤】
1、停止MySQL服务。
2、拷贝数据目录。
创建D:MariaDB_DATA目录,并给该目录添加NETWORK SERVICE权限,
将C:Program FilesMariaDB 10.0data目录里面的内容全部拷贝到D:MariaDB_DATA。
3、移动配置文件。
将my.ini文件由
C:Program FilesMariaDB 10.0datamy.ini
移动到
C:Program FilesMariaDB 10.0my.ini
4、修改配置文件。
在C:Program FilesMariaDB 10.0my.ini文件中添加或修改以下两项。
[mysqld] basedir=C:Program FilesMariaDB 10.0 #程序安装目录 datadir=D:MariaDB_DATA #数据目录
5、修改注册表:
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesMySQLImagePath
将
"C:Program FilesMariaDB 10.0inmysqld.exe" "--defaults-file=C:Program FilesMariaDB 10.0datamy.ini" "MySQL"
修改为
"C:Program FilesMariaDB 10.0inmysqld.exe" "--defaults-file=C:Program FilesMariaDB 10.0my.ini" "MySQL"
6、启动MySQL服务。
用上面的方法避免了1067以及Errcode: 13 "Permission denied"等错误。
另外,如果服务启动失败可以通过错误日志文件排查错误,文件为数据目录下hostname.err,hostname是当前主机名。