MariaDB 中的使用者權限

MariaDB 中的使用者權限

我有一個 MariaDB 10.1 實例(Debian GNU/Linux 9 測試/不穩定)。它的目的是作為一個本地網路資料庫伺服器,僅此而已。對於超出此問題範圍的問題,該伺服器不得託管除資料庫本身之外的任何其他內容,資料庫必須偵聽伺服器 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 的伺服器,我可以連接到資料庫伺服器,但使用者root似乎缺乏某種權限:

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

我應該向資料庫伺服器發出什麼命令才能使root(或其他使用者)查看所有資料庫及其中的所有表?

答案1

我在#mariaIRC頻道中得到的解決方案:

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;

請注意區別:它是 agrant all on ...而不是 a grant all PRIVILEGES on...

相關內容