mysql 5.7.12 运行不了啊_mysql 5.7.12----bin/mysqld --initialize --user=mysql出错

标签:

我最近在安装mysql 5.7.12,本来之前安装mysql 5.7.11时用命令

bin/mysqld --initialize --user=mysql

可以很好的初始化,但是用在5.7.12版本居然报错

[root@centos mysql-5.7.12]# bin/mysqld --initialize --user=mysql

2016-04-28T09:50:25.142068Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2016-04-28T09:50:25.142323Z 0 [ERROR] Can‘t find error-message file ‘/usr/local/mysql/share/errmsg.sys‘. Check error-message file location and ‘lc-messages-dir‘ configuration directive.

2016-04-28T09:50:25.144865Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.

2016-04-28T09:50:25.144934Z 0 [ERROR] Aborting

后来发现centos自带的/etc/my.cnf和/etc/mysql没有删掉,后来删掉这两个文件之后在此使用这个命令

仍然报错

mysqld: Can‘t create directory ‘/usr/local/mysql/data/‘ (Errcode: 2 - No such file or directory)

2016-04-28T09:53:24.465575Z 0 [ERROR] Can‘t find error-message file ‘/usr/local/mysql/share/errmsg.sys‘. Check error-message file location and ‘lc-messages-dir‘ configuration directive.

2016-04-28T09:53:24.467928Z 0 [ERROR] Aborting

后来在网上一查发现使用mysqld命令时要初始化

应该在mysql祝文件夹下创建data文件,但是记得在5.7.11版本里面的data文件是自动生成的

mkdir data

然后执行下面一句

bin/mysqld --user=mysql --basedir=/usr/local/mysql-5.7.12 --datadir=/usr/local/mysql-5.7.12/data/  --initialize

2016-04-28T10:01:07.730549Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2016-04-28T10:01:08.194212Z 0 [Warning] InnoDB: New log files created, LSN=45790

2016-04-28T10:01:08.725913Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2016-04-28T10:01:08.810579Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 213135a4-0d28-11e6-b869-000c299613e3.

2016-04-28T10:01:08.816207Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.

2016-04-28T10:01:08.819712Z 1 [Note] A temporary password is generated for root@localhost: %?kTFF

这算是成功了把,给出了初始密码,接下来把support-files/my-default.cnf复制到/etc/下,并配置一下

就可以了!

标签:

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值