# for newer mysql or mariadb version
ALTER USER 'root'@'localhost' IDENTIFIED BY 'ZeKQxTW57VgDP0VN';
ALTER USER 'root'@'%' IDENTIFIED BY 'ZeKQxTW57VgDP0VN';
# for older mysql or mariadb version
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('ZeKQxTW57VgDP0VN');
SET PASSWORD FOR 'root'@'%' = PASSWORD('ZeKQxTW57VgDP0VN');
# local root login test
mysql -u root -pZeKQxTW57VgDP0VN
# make root can access from remote
grant all privileges on *.* to root@'%' identified by 'ZeKQxTW57VgDP0VN';
# remote test
mysql -h xx -u root -pZeKQxTW57VgDP0VN
new mysql modify password
最新推荐文章于 2024-10-30 11:16:50 发布
本文介绍了如何为MySQL或MariaDB的root用户设置统一的新密码,并授予远程访问权限。包括了针对新旧版本的不同操作方法及本地和远程登录测试。
822

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



