sudo su 工作后的 mysql; mysql 或 sudo mysql 失败

sudo su 工作后的 mysql; mysql 或 sudo mysql 失败

我正在访问mysql安装(不知道细节)

[user@host ~]$ mysql -u kco -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'kco'@'localhost' (using password: YES)

检查了一下,我得到的密码似乎是正确的。我注意到在给我的示例中,它们一直以 root 身份运行。

[user@host ~]$ sudo mysql -u kco -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'kco'@'localhost' (using password: YES)

[Sudoers 有带有 NOPASSWD 的轮子。] 好吧,不是这样。或者是吗?

[user@host ~]$ sudo su
[root@host user]# mysql -u kco -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 196356
Server version: 5.1.73 Source distribution

奇怪的。认为这可能是套接字权限的问题,但是

[root@host user]# ls -l /var/lib/mysql/mysql.sock
srwxrwxrwx. 1 mysql mysql 0 Mar 19 18:39 /var/lib/mysql/mysql.sock

嗯。很快就遭到了否决,所以让我更明确地提出问题。期望的结果是普通用户能够 mysql -u kco -p 。为什么需要 root shell(而不是 sudo)才能访问 UI?

相关内容