我有一个MariaDB 10.1实例(Debian /Linux9测试/不稳定)。它是指本地网络数据库服务器,而不是其他任何东西。对于超出此问题范围的响应,除了数据库本身之外,该服务器不得承载任何其他内容,数据库本身必须侦听服务器IP地址(10.7.33.102)。
如果我从服务器shell连接到数据库,就可以了:
root@datangshan:~# mysql
[...]
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| drackmd |
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec)drackmd是其他主机需要使用的数据库。我尝试使用以下命令使root用户能够从另一个主机进行连接:
grant all privileges on `*`.`*` to 'root'@'10.7.33.107' identified by 'secret' with grant option;然后,从10.7.33.107的服务器上,我可以连接到DB服务器,但是root用户似乎缺乏某种权限:
root@10.7.33.107:~# mysql -h 10.7.33.102 -p
Enter password:
[...]
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)我应该向DB服务器发出什么命令,让root (或其他用户)查看它们中的所有数据库和所有表?
发布于 2017-01-15 07:32:15
我在IRC上的#maria频道找到了解决方案:
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;请注意不同之处:它是grant all on ...而不是grant all PRIVILEGES on...。
https://serverfault.com/questions/826273
复制相似问题