MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| test |
+——————–+
4 rows in set (0.00 sec)
MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]> update user set host = ‘%’ where user = ‘root’;
ERROR 1062 (23000): Duplicate entry ‘%-root’ for key ‘PRIMARY’
MariaDB [mysql]> GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> FLUSH PRIVILEGES
-> ;
Query OK, 0 rows affected (0.00 sec)
这样就ok了

本文介绍如何在MariaDB中为root用户设置全局权限,并更新主机名。通过执行特定的SQL命令,实现对root用户的权限调整,并刷新权限缓存。
2136

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



