开发者

Error 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

开发者 https://www.devze.com 2023-03-05 22:29 出处:网络
I\'m on Ubuntu 11.04. Everything works PHP, PHPMYADMIN, manual login to MySQL etc. I have writ开发者_开发问答ten a C application that uses MySQL. Now, when I start this application I receive the abo

I'm on Ubuntu 11.04. Everything works PHP, PHPMYADMIN, manual login to MySQL etc.

I have writ开发者_开发问答ten a C application that uses MySQL. Now, when I start this application I receive the above error. I tried to prevent that from happening by linking the original file into the /tmp/ folder (ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock), however, after a while I start getting this error again - because my link has been removed, which is frustating.

What do I need to do to make this work?


The MySQL libraries are compiled with a default of /tmp/mysql.sock. The server is started up with /var/run/mysqld/mysql.sock and your $HOME/.my.cnf does not reflect this value in the [client] section.

If this is run without a valid $HOME you may need to use mysql_options with MYSQL_READ_DEFAULT_FILE.


Try linking the file in other location than /tmp/ and use it from there

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号