Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

修改配置文件,无密码登录 编辑文件:

/etc/mysql/mysq.conf.d/mysqld.cnf

加入skip-grant-tables 跳过密码登录;

重启mysql服务

systemctl restart mysql.service

进入mysql

# mysql;
# use mysql;
# 更新密码为空
# UPDATE user SET authentication_string='' WHERE User='root' AND Host ='localhost';

# flush privileges;
退出

注释掉skip-grant-tables

重启mysql,无密码登录