环境Ubuntu14.04 mysql5.5
这个错误是我用mysql_real_connect()函数的时候,返回的错误打印出来的。
可以先看这个篇如果解决就可以了:
http://blog.csdn.net/leisure512/article/details/5139104
如果不行可以把继续往下试:
mysql_real_connect(connect, “localhost”, g_db_username, g_db_password, g_dbname, 0, NULL, 0);
改为:
mysql_real_connect(connect, “127.0.0.1”, g_db_username, g_db_password, g_dbname, 0, NULL, 0);
参考:
1.http://blog.csdn.net/leisure512/article/details/5139104
2.https://help.memsql.com/hc/en-us/articles/115001215603-ERROR-2002-HY000-Can-t-connect-to-local-MySQL-server-through-socket-var-run-mysqld-mysqld-sock-