mysql5.6和5.7的权限密码设置
mysql5.6
grant all privileges on *.* to root@'%' identified by "mysql_pwd" with grant option;
grant all privileges on *.* to root@'localhost' identified by "mysql_pwd" with grant option;
grant all privileges on *.* to root@'127.0.0.1' identified by "mysql_pwd" with grant option;
drop database if exists test;
use mysql;
delete from user where not (user='root');
delete from db where user='';
UPDATE user SET password=PASSWORD('mysql_pwd') WHERE user='root' AND host='127.0.0.1' OR host='%' OR host='localhost';
delete from user where password='';
flush privileges;
select user,password,host from mysql.user;
exit;
mysql5.7:
grant all privileges on *.* to root@'%' identified by "mysql_pwd" with grant option;
grant all privileges on *.* to root@'localhost' identified by "mysql_pwd" with grant option;
grant all privileges on *.* to root@'127.0.0.1' identified by "mysql_pwd" with grant option;
drop database if exists test;
use mysql;
delete from user where not (user='root');
delete from db where user='';
delete from user where authentication_string='';
update mysql.user set authentication_string=password('mysql_pwd') where user='root' AND host='127.0.0.1' OR host='%' OR host='localhost';
flush privileges;
select user,authentication_string,host from mysql.user;
exit;
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步