mysql 1067 datadir_MySQL修改datadir后启动服务发生1067错误的解决办法

当前windows下最新版的mysql (5.6.22.0)在安装时没有指定安装路径和数据存放路径的选项,而是默认把程序安装在C盘Program Files下,数据也存放在C:/ProgramData下面,找到my.ini,修改datadir变量后重启服务会报1067错误。解决办法如下:

来自:http://bugs.mysql.com/bug.php?id=68584

我用中文大概总结一下:

原因:安装MySQL后在创建MySQL服务时使用的是NETWORK SERVICE的用户,当你改变datadir之后,新的路径NETWORK SERVICE没有读写权限。

解决办法:给MySQL服务的登录账户赋予可读写权限。具体操作如下:

1、在服务那里右击MySQL服务名>属性>登录>查看创建服务的账户名,一般是NETWORK SERVICE。

2、给datadir指定的目录添加NETWORK SERVICE具有所有权限。

[13 Mar 2013 7:59] david trillo

I write on the right my.ini file.

The service is created like this:

"C:\Archivos de programa\MySQL\MySQL Server 5.6\bin\mysqld" --defaults-file="C:\Documents and Settings\All Users\Datos de programa\MySQL\MySQL Server 5.6\my.ini" MySQL56

And THIS is the file iI'm changing!

Finally, i got WHY was this error happening!

When creating the service, It used a user like NTblablabla, instead of a local user.

After changing this, everything was OK!

i'm happy to find the solution. It wasn't the datadir, but how the service was created (the user)!

i hope this can be useful to other users!

[13 Mar 2013 21:28] Wichen Moormann

Thanks to david trillo. We solved the problem also.

It was not a matter of correct my.ini.

It was a matter of user rights of service and data dir.

Let me describe it for Windows Server 2008 R2, which was the last OS i used.

I am always logged in as administrator, but that is not the point.

Important is:

The installer installs the service by default for the user: "network service"

(see properties of the service MySQ56).

If we copy the data dir to a new location (e.g. C: to D:) it has by default

the security rights of the user: "local system"

(see properties of the the new data dir).

---------------------------------------------------------

These different user/rights are the reason for 1067 here.

---------------------------------------------------------

Now we have at least 2 choices:

1. change the service user to: "local system" (as david trillo did)

or

2. add to the data dir security properties the user: "network service",

with all rights.

Both solution work OK when the service is started!

On other OS the problem should be solved analogous.

I hope this is helpfull for others.

Thanks to david trillo again.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值