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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM