I was running a successful (drupal) site using Mysql (I'm on Mac OS X) until I suddenly started to get the following error: "PDOException: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in db_table_exists()"
I don't know what this means or how to fix it, but when I visit phpmyadmin I get the following message: "#2013 - Lost connection to MySQL server at 'reading initial communication packet', system error: 61"
#Mitch: I installed it using the acquia drupal dev desktop stack, although I also have MAMP installed. I tried restarting the servers using these programs and this is the error I got (above). Can you perhaps provide more detailed instructions? Thanks.
It means your database is off (or crashing). You need to restart it. This will vary depending on how you installed MySQL.
You probably need to comment out the bind address in my.conf.
edit: no, seriously.
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock'
means MySQL can't be connected through the socket file.
Check if /tmp/mysql.sock is present (including permissions), if not check your my.cnf where it is (or run mysql_config --socket).
So you can either make a symbolic link or alternatively specify unix_socket path in your settings.php file ('unix_socket' => '/tmp/mysql.sock',).
Related
Every time I reboot my computer and try to access my mysql database it produces the following error:
ERROR 2002 (HY000):
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
any ideas on how to resolve this?
It might be that your MySQL is not started automatically on system start-up. Kindly execute mysqld to start the MySQL.
Or please refer https://askubuntu.com/questions/416309/start-mysql-on-startup, to start MySQL on system start-up, assuming that you are on Linux OS.
I installed wampserver on my xp machine month ago.. Now when I try to connect to mysql via phpmyadmin or mysql console I get the error :
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost'
(10061)
Wamp icon in the tray is green meaning it's running ok.. I checked for mysql service and it's running and using the port 3306 .. I turned off the firewall.. I tried everything and it's not working.. I eventually uninstalled wamp totally and removed all its files and re-installed it again and same error.. When I try to telnet localhost 3306 it doesn't connect and I get the error :
Could not open connection to the host on port 3306: connect failed
I searched the web for hours, but didn't find any working solution. It seems that many people are having the same problem and most of them didn't find the solution.
Ok .. searching the internet for more several hours I've found one little clue that actually fixed my problem.
When I type netstat -a I get a list of active ports including 3306 (the one mysql uses). The Foreign Address column for some ports is 0.0.0.0.0 but for 3306 is [::]:0. I'm not a network guy but it turned out that it means it's a IPv6 port and it should be IPv4.
Adding the following line in the file my.ini under [mysqld] and restarting the service solved the problem.
bind-address=127.0.0.1
Note
My wamp version is 2.4 and mysql version is 5.6.12 running under win XP.
my.ini file for me is located at c:\wamp\bin\mysql\mysql5.6.12.
Hope this helps who suffered my pain.
In my.ini there is - for example -the entry
# Secure File Priv.
secure-file-priv="C:/ProgramData/MySQL/MySQL Server 5.7/Uploads"
If this path is not (further) existing, mysql cannot be started.
You have then to put an existing path.
I also did some research on my side I reconfigure the sql parameters then in the type and networking section you have to uncheck the open windows button Firewall ports for network access then you have to press next until closing without anything modify other
I've run into a problem here, and I'm not sure what to do. I migrated a Yosemite Mac to a new Mac Pro. Apache turns on, but MySql does not with this error: The operation couldn’t be completed. (XAMPPErrorDomain error 1.)
I didn't know if I need to reinstall MySql or upgrade it, or what this error means. I created the plist file as in the example and ran permissions, but that did not change the outcome. Going to websites in localhost, WordPress shows an error establishing db connection.
I went to Github to install MySql and it went fine, but it does not work with Xampp and Desktop Server. I chose to NOT start MySql when I rebooted, but apparently the Github version started anyway (and I cannot find a way to turn it off!) Now when I try to start MySql from Xampp, it says another version is already running.
Any help appreciated.
When I ask for version number in terminal I get this response:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
HOWEVER, when I went to /var/ and temp I found an alias for mysql.sock, BUT it was not connected to an original file... Now that file does not exist anywhere on my computer.
Open /Applications/XAMPP/xamppfiles/xampp and add this line somewhere at the top:
unset DYLD_LIBRARY_PATH
I found that what was required was a complete uninstall of MySql following this procedure: http://bytearrays.com/completely-uninstall-mysql-mac-osx/
And then a reinstall. ServerPress.com was very helpful in diagnosing the problems.
I have tried all the solutions to access mysql that are described before in stackoverflow.
When I type mysql and the terminal asks for password,when I type password and press enter it says ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Any idea,this problem making me crazy.
Thanks in advance.
Make sure you're starting the mysql server first. The command is sudo mysqld_safe. Also try looking at my.cnf (likely in /etc/) and search for "socket". You may need to change the socket location to /tmp/mysql.sock.
once i try to connect to mysql on phpmyadmin in ubuntu i got this error
2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
but with mysql query browser i connect with out any error and it works
why phpmyadmin does not connect?
The command line client uses a unix domain socket while PHPmsyqladmin uses a network socket. You'll need to enable the network socket in the mysql config, most likely.
EDIT:
You can read about some of the troubleshooting (and windows) side of this: http://dev.mysql.com/doc/refman/5.1/en/can-not-connect-to-server.html
And here is how to set up mysql to use a network config:
http://www.howtogeek.com/howto/mysql/switch-mysql-to-listen-on-tcp/