简体   繁体   English

无法连接到mysql服务器

[英]can't connect to mysql server

I have a problem installing mysql 5.5.20 on my ubuntu 11.10. 我在我的ubuntu 11.10上安装mysql 5.5.20时遇到问题。 after "ps -e | grep mysql" I found mysqld_safe and mysqld is running, but it is not right when I try to connect to the server, the error is like this: 在“ps -e | grep mysql”之后我发现mysqld_safe和mysqld正在运行,但是当我尝试连接到服务器时它不对,错误是这样的:


ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) ERROR 2002(HY000):无法通过套接字'/var/lib/mysql/mysql.sock'连接到本地MySQL服务器(2)


I have check the /etc/my.cnf which locate the mysql.sock in /var/lib/mysql/mysql.sock, and the access right of that folder is: 我查了/etc/my.cnf,它找到了/var/lib/mysql/mysql.sock中的mysql.sock,该文件夹的访问权限是:


drwxrwxr-x 2 mysql mysql 4096 2012-01-17 01:54 mysql drwxrwxr-x 2 mysql mysql 4096 2012-01-17 01:54 mysql


after "find mysql.sock" I found it in /var/run/mysql, it is really confusing any help will be appreciated, many thanks~ 在“找到mysql.sock”之后我在/ var / run / mysql中找到了它,真是令人困惑,任何帮助都会受到赞赏,非常感谢〜

Often that error message can mean something wrong at an application level, rather than with MySQL. 通常,该错误消息可能在应用程序级别而不是MySQL中表示错误。

Open Terminal and attempt to connect to MySQL. 打开终端并尝试连接到MySQL。

mysql -u root -p

Press Enter , then enter your password and hit Enter again. Enter ,然后输入您的密码并再次按Enter Enter Once you're in, use SHOW DATABASES to find out what databases are available and if the one you're trying to connect to is there. 进入后,使用SHOW DATABASES查找可用的数据库以及您尝试连接的数据库是否存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM