如果mysql忘记密码或者远程登录的时候需要做一些配置
1.修改my.cnf(linux一般在/etc/目录下) 配置忽略密码
忘记密码
[mysqld]这一行下面添加
skip-grant-tables
2登录mysql
执行命令行:
mysql -u root
忽略密码回车登录
3.本地登录
登录之后输入
flush privileges;
grant all privileges on *.* to 'root'@'localhost' identified by '123456' with grant option;
flush privileges;
退出之后,在本地就可以使用root 123456进行登录了
4.远程登录
登录之后输入
flush privileges;
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;
退出之后,远程就可以使用root 123456进行登录了