1.找不到初始密码可以在/etc/my.cnf中[mysqld] 添加:skip-grant-tables
2、重启mysql
service mysqld restart
3、修改MySQL数据库配置文件无密码登录后,修改密码报错:
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
解决方式是先执行:flush privileges;
4.再执行修改密码命令,可以了:
set password for root@localhost=password('你的密码');
5、把/etc/my.cnf中skip-grant-tables 注释掉,然后重启mysql就可以正常用密码登录了
6、修改远程连接方式
use mysql;
select host,user from user;
update user set host='%' where user='root';
flush privileges;