大网数据广告活动
服务器运维问答

user permissions in MariaDB

· 52CE 我爱测

I have a MariaDB 10.1 instance (Debian GNU/Linux 9 testing/unstable). It is meant to be a local network database server and nothing else. For resons beyond the scope of this question, that server must not host anything else excep…

问题原文

原帖链接 · Lucio Crusca · CC BY-SA 3.0

I have a MariaDB 10.1 instance (Debian GNU/Linux 9 testing/unstable). It is meant to be a local network database server and nothing else. For resons beyond the scope of this question, that server must not host anything else except the database itself, which must listen on the server IP address (10.7.33.102).

If I connect to the database from the server shell, all is ok:

root@datangshan:~# mysql
[...]
MariaDB [(none)]> show databases;

+--------------------+
| Database           |
+--------------------+
| drackmd            |
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.00 sec)

The drackmd is the database other hosts need to use. I've tried enabling root user to connect from another host with the following command:

grant all privileges on `*`.`*` to 'root'@'10.7.33.107' identified by 'secret' with grant option;

Then, from the server at 10.7.33.107, I can connect to the DB server, but the root user seems to lack some kind of permission:

[email omitted]:~# mysql -h 10.7.33.102 -p
Enter password: 
[...]
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)

What command should I issue to the DB server to make root (or other users) see all databases and all tables in them?

已采纳解答

原帖链接 · Lucio Crusca · CC BY-SA 3.0

Solution I got in the #maria channel on IRC:

drop user 'root'@'10.7.33.107';
drop user 'root'@'%';
flush privileges;
grant all on `*`.`*` to 'root'@'10.7.33.107' identified by 'secret' with grant option;

Please note the difference: it's a grant all on ... instead of a grant all PRIVILEGES on....

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-01-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。