Centos7如何修改或重置MySQL8.0的root密码
一、修改配置文件
1、停止mysql服务
service mysqld stop
2、修改配置文件/etc/my.cnf
1)输入命令:vim /etc/my.cnf
2)按I进入编辑模式,在my.cnf文件中添加skip-grant-tables(意思是忽略密码),按esc键,输入:wq保存退出
3、启动/重启Mysql
service mysqld start
或
service mysqld restart
二、免密码登录mysql并设置把密码先设置为空字符串
1、登录:mysql -u root -p
2、按回车直接进入数据库
3、使用数据库:use mysql;
4、查看root用户信息:select host, user, authentication_string, plugin from