MySQL 常见问题

重置密码
关闭mysql服务
sudo /etc/init.d/mysql stop
用mysql安全模式运行并跳过权限验证
sudo mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
用空密码方式使用root用户登录 mysql
sudo mysql -u root mysql
更新密码
update user set Password = PASSWORD('root') where User ='root';
update mysql.user set authentication_string=password('root') where user='root' ;
刷新权限
FLUSH PRIVILEGES;
退出
quit
密码过于简单。 (5.7以上需要重置密码 ) 8位,大小写字母,特殊符号
You must reset your password using ALTER USER statement before executing this statement
进去mysql配置项
vim /etc/my.cnf
跳过验证
[mysqld]
添加skip-grant-tables
修改密码
alter user 'root'@'localhost' identified by '#20as3SElksds0ew98';
刷新权限
FLUSH PRIVILEGES;

本作品采用《CC 协议》,转载必须注明作者和本文链接
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!