After looging in to my ubuntu machine, I try to login to my database using the following command in the shell:
mysql --user=root -p
Then I get the error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2).
What I have tried:
Uninstall and reinstall -> same error afterward.
sudo service mysql start -> Job for mysql.service failed.
Used configuration template in my.cnf (which is /etc/mysql for Linux).
search for mysqld.sock -> The system doesn't find.
Does anybody have another solution that I could try? Thanks!
I was able to connect to SQL by getting another droplet at digital ocean. I install SQL in the new droplet and worked like a charm. I don't understand why the other droplet was giving me that error. Thanks everyone.
Related
I tried a lot to install MySQL8 via Homebrew on Mac 10.14.5. I was running MySQL 5.7 before that and did the following: I removed MySQL completely via this tutorial: https://coderwall.com/p/os6woq/uninstall-all-those-broken-versions-of-mysql-and-re-install-it-with-brew-on-mac-mavericks
After that I run mysql and got the message that the command was not known. So I installed mysql with brew install mysql. After installation I did brew link --force mysql and got Warning: Already linked: /usr/local/Cellar/mysql/8.0.19
I edited /usr/local/etc/my.cnf and added default-authentication-plugin=mysql_native_password in the [mysqld] section. After that I restartet the service using brew services restart mysql
brew services list shows me this now:
mysql started root /Library/LaunchDaemons/homebrew.mxcl.mysql.plist
mysql#5.7 stopped
However, when I type mysql in the terminal I get this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
The /tmp/mysql.sock does not exist.
When I change the host in the my.cnf file from localhost to 127.0.0.1 this error will change into this:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 54
Anyone has an idea what's going on here and how I can fix it? I also googled it and found various Threads, some are saying that the permissions must be changed to this sudo chown -R _mysql:mysql /usr/local/var/mysql but this does not change anything in my case.
I have started mysql using
brew services start mysql
and I made sure that mysql is started by checking it using
brew services list
it shows that the status of mysql is "started".
however when I try to run the command
mysql
it'll say:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (62)
I have searched online for multiple answers already but none of them would solve my problem.
How should I solve this?
in my mac, run this will solve my problems
$ sudo mysql.server start
I downloaded Mac OSX MySQL Community edition (http://dev.mysql.com/downloads/mysql/), and when I start it at
/usr/local/mysql/bin/mysql
I meet with the following issue:
ERROR 2002 (HY000):
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Anyone have any good ideas? Thanks in advance.
Meeting with new issues cannot connect to local MySQL instance using MySQL WorkBench, here are my setup and error, looks access denied and anyone have any ideas?
Most likely the service isn't running or it's looking for the socket in the wrong path.
The /usr/local/mysql/bin/mysql call you made is actually the client, not the server/service.
There should be a mysql_safe executable in that same directory -- try calling that first (you may have to be root).
sudo /usr/local/mysql/bin/mysqld_safe
I run the mysql command at the command line but I get this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I've Googled a lot but I'm unable to resolve the issue.
Please HELP!
It sounds like mysql isn't running. This will tell you if it is or not:
sudo netstat -tap | grep mysql
That's because the path you specified doesnt have the socket required to connnect to the mysql. This problem has happened with me. Either you can reinstall mysql or search for the mysqld.sock and then move it to the specified directory.
Try running this command to start the mysql server
/etc/init.d/mysql start
/etc/init.d/mysql restart
MySQL is broken on my Ubuntu OS. It throws the following error:
mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I wasn't able to repair it. So I want to reinstall MySQL. But I didn't find an effective way.
I used sudo apt-get remove mysql-server-5.1,
But after the re-installation, it is still throwing the same error. Any help?
Restart mysqld.
I don't know how I change the passwrod,this may occur when i use some rails app,
in fact i have set a password for mysql,but when i execute rails rake:db:schema:crate, seems it set the password empty