mysqd --initialize和默认搜索路径上的my.cnf的冲突

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
The following groups are read: mysqld server mysqld-5.7


我们使用mysqld去初始化数据库,也会默认去读以上列出的那些cnf文件,这就会造成莫名其妙的问题
通过下面可以看出像mysql这个数据库就没有创建,解决这个问题就是在初始化数据库的时候加上--no-defaults参数
[mysql@rws1270149 bin]$ ./mysqld --initialize --datadir=/scratch/mysql5.7/data2 --basedir=/scratch/mysql5.7
[mysql@rws1270149 bin]$ ls -al ../data2
total 10498080
drwxr-x---  2 mysql mysql       4096 Jun 18 23:10 .
drwxr-xr-x 12 mysql mysql       4096 Jun 18 23:10 ..
-rw-r-----  1 mysql mysql        197 Jun 18 23:10 ib_buffer_pool
-rw-r-----  1 mysql mysql 2147483648 Jun 18 23:10 ib_logfile0
-rw-r-----  1 mysql mysql 2147483648 Jun 18 23:10 ib_logfile1
-rw-r-----  1 mysql mysql 2147483648 Jun 18 23:10 ib_logfile2
-rw-r-----  1 mysql mysql 2147483648 Jun 18 23:10 ib_logfile3
-rw-r-----  1 mysql mysql 2147483648 Jun 18 23:10 ib_logfile4
-rw-r-----  1 mysql mysql   12582912 Jun 18 23:10 ibdata1

[mysql@rws1270149 bin]$ ./mysqld --no-defaults --initialize --datadir=/scratch/mysql5.7/data3 --basedir=/scratch/mysql5.7
2019-06-19T06:21:21.279617Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-06-19T06:21:21.449518Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-06-19T06:21:21.526726Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-06-19T06:21:21.581174Z 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: 74ccf413-925a-11e9-ace7-0021f6312ac3.
2019-06-19T06:21:21.581992Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-06-19T06:21:21.582714Z 1 [Note] A temporary password is generated for root@localhost: qquLLpk9mF?V
[mysql@rws1270149 bin]$ ls -al ../data3
total 110628
drwxr-x---  5 mysql mysql     4096 Jun 18 23:21 .
drwxr-xr-x 13 mysql mysql     4096 Jun 18 23:21 ..
-rw-r-----  1 mysql mysql       56 Jun 18 23:21 auto.cnf
-rw-r-----  1 mysql mysql      419 Jun 18 23:21 ib_buffer_pool
-rw-r-----  1 mysql mysql 50331648 Jun 18 23:21 ib_logfile0
-rw-r-----  1 mysql mysql 50331648 Jun 18 23:21 ib_logfile1
-rw-r-----  1 mysql mysql 12582912 Jun 18 23:21 ibdata1
drwxr-x---  2 mysql mysql     4096 Jun 18 23:21 mysql
drwxr-x---  2 mysql mysql     4096 Jun 18 23:21 performance_schema
drwxr-x---  2 mysql mysql    12288 Jun 18 23:21 sys
<=======可以看到sys mysql performance_schema这几个数据库都创建了

参考了这个帖子

https://blog.csdn.net/yeyuyyy/article/details/53765660

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值