Mysql 5.5 - 无法连接用户但root - ERROR 1045(28000)

时间:2014-03-29 09:27:27

标签: mysql ubuntu phpmyadmin

问题

我已经安装了一台装有Ubuntu 13.10的PC,安装了mysql-server-5.5.35和phpmyadmin-4.4.0.9-1。 使用phpmyadmin,我创建了用户' jeby6372'' &安培; ''内部'',为每个人设置密码和读/写/插入/删除全局权限。

我无法连接用户,但是根据Mysql服务器连接。

反馈

jeby6372@mercure:~$ mysql --version
mysql  Ver 14.14 Distrib 5.5.35, for debian-linux-gnu (x86_64) using readline 6.2

在root下连接:

jeby6372@mercure:~$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 123
Server version: 5.5.35-0ubuntu0.13.10.2 (Ubuntu)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> 

连接其他用户:

jeby6372@mercure:~$ mysql -u jeby6372 -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'jeby6372'@'localhost' (using password: YES)

问题与内部用户

相同

这是通过phpmyadmin视图我的权限配置的快照:

enter image description here

当我通过phpmyadmin创建用户时,它可能会在更新mysql数据库中的密码时出错,所以我在MySql root下运行:

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> SET PASSWORD FOR 'jeby6372'@'localhost' = PASSWORD('mypassword');ERROR 1133 (42000): Can't find any matching row in the user table
mysql> SET PASSWORD FOR 'jeby6372'@'%' = PASSWORD('alpha1237');
Query OK, 0 rows affected (0.00 sec)

mysql> quit

有什么想法吗?

我在Ubuntu 12.04上运行Mysql 5.5.35的其他服务器上的配置相同,但它们运行正常。

有什么建议吗?

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

%不包含localhost。通过套接字(或Windows上的命名管道)连接时,主机是localhost;与TCP / IP连接相同的主机由127.0.0.1引用。

因此,在您的情况下,连接类型可能是套接字,因此jeby6372@%与连接尝试不匹配。这与默认MySQL安装随root@localhostroot@127.0.0.1一起提供的原因相同;他们有不同的连接类型。

请参阅#1044 - Access denied for user 'someuser'@'localhost' to database 'somedb'https://dev.mysql.com/doc/refman/5.1/en/account-names.html

希望能为你清除它。