mysql8.0 初始化数据库及表名大小写问题
删除DATA文件夹
rm -rf /var/lib/mysql
重新初始化并启动MYSQL
mysqld --initialize --console --lower-case-table-names=1
vim /etc/my.cnf.d/mysql-server.cnf
--增加
skip-grant-tables
lower-case-table-names=1
chown -R mysql:mysql /var/lib/mysql/
systemctl start mysqld
systemctl status mysqld
重新初始化登录帐户
vim /etc/my.cnf.d/mysql-server.cnf
--增加
skip-grant-tables
lower-case-table-names=1
--退出后重启
systemctl stop mysqld
systemctl start mysqld
--开始重置密码
mysql -uroot -p --输入任意密码
--必须先执行 flush privileges,否则会报The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
flush privileges;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'tw369.com';
UPDATE USER SET host ="%" where user = "root";
flush privileges;
exit
启动服务
删除配置文件的 skip-grant-tables
systemctl restart mysqld