我有一个MariaDB 10.1实例(Debian GNU / Linux 9 testing / unstable)。 这意味着是一个本地networking数据库服务器,没有别的。 对于超出此问题范围的响应,除服务器IP地址(10.7.33.102)上的数据库本身外,该服务器不得托pipe任何其他内容。
如果我从服务器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 (或其他用户)看到所有数据库和其中的所有表?
我在IRC的#maria频道获得解决scheme:
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 on ...而不是grant all PRIVILEGES on...