使用su后无法使用unix_socket连接到mysql

时间:2015-11-13 08:47:53

标签: mysql unix mariadb

我在Red Hat Enterprise Linux 7上运行本地主机MySQL / MariaDB服务器,并且我已配置两个用户shwang@localhostapp@localhost以获得unix_socket插件的授权

正如预期的那样,当我登录自己的帐户时,我可以使用unix_socket对自己进行身份验证。

shwang@grimoire ~ % mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3817
Server version: 5.5.44-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

然而,当我使用su来切换s​​norby用户时,MySQL似乎认为我仍然是shwang@localhost

shwang@grimoire ~ % sudo su - snorby

app@grimoire ~ % mysql
ERROR 1698 (28000): Access denied for user 'shwang'@'localhost'

app@grimoire ~ % mysql -u snorby
ERROR 1698 (28000): Access denied for user 'snorby'@'localhost'

我在这里遗漏了什么吗?当unix_socket进入shwang帐户时,su是否真的将我识别为snorby

1 个答案:

答案 0 :(得分:0)

不是Linux抱怨,而是MariaDB。您显然没有GRANTed访问TO shwang@localhost