-- 切换数据库
use mysql;
-- 修改密码
alter user 'root'@'localhost' identified by 'root';
-- 刷新权限表
flush privileges;
-- 设置任意IP访问
update user set host='%' where host='localhost';
这篇博客介绍了如何在MySQL中切换数据库,修改root用户的密码,以及如何允许任意IP访问。通过`use mysql;`切换到mysql库,使用`alter user 'root'@'localhost' identified by 'root';`更新密码,然后`flush privileges;`刷新权限。最后,更新users表,将主机限制从localhost改为%,以实现远程访问。
-- 切换数据库
use mysql;
-- 修改密码
alter user 'root'@'localhost' identified by 'root';
-- 刷新权限表
flush privileges;
-- 设置任意IP访问
update user set host='%' where host='localhost';
5562
470
1206
705
719

被折叠的 条评论
为什么被折叠?