1、安装完MySQL5.6.48之后,使用mysql -u root -p登录MySQL时报错:
2.通过以下方法解决:
service mysqld stop #首先关闭mysql服务
mysqld_safe --user=root --skip-grant-tables --skip-networking & #然后使用mysqld_safe跳过权限方式启动
mysql #然后直接登录,跳过密码验证
update mysql.user set password=password('root') where user='root'; #将密码设置为1root