1. mysql忘记root密码
(1)停止mysql
/etc/init.d/mysql stop
(2)启动mysql,忽略授权登录验证
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
(3)进入数据库系统
mysql -u root mysql
(4)修改密码
mysql> UPDATE user SET Password=PASSWORD(‘abc123’) where USER='root'; mysql> FLUSH PRIVILEGES; mysql> quit
(5)重新启动mysql
/etc/init.d/mysql restart
(6)登陆数据库
mysql -uroot –p
2. 解决远程无法连接mysql
给用户赋予权限
grant all privileges on *.* to root@192.168.191.168 identified by 'abc123';