I am using MAC OS Sierra . and trying to access mysql but getting error like
UserXs-MacBook-Pro:~ Ayaz$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
UserXs-MacBook-Pro:~ Ayaz$
If you have your MySQL UP and running, you could try the following step to get your issue sorted out!
This worked for me and hope works for you too!
sudo /usr/local/mysql/support-files/mysql.server start
This is an interesting question on SO which is on a similar discussion, hope that this helps!!!
Related
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 have been setting up a new laptop for development purposes and when trying to get MySQL to run in the Terminal I get the following message:
$ mysql -u root -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Can somebody please help me out here?
You may get this error because mysql server is not started. For me it solved only by starting mysql server.
to start Mysql server (for Mac OS X), command line in terminal:
sudo /usr/local/mysql/support-files/mysql.server start
or, simply go to your Mac System Preference --> MySQL --> click on start mysql..
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 just upgraded my comp to the beta Yosemite and now my MySQL is giving me a connection problem.
I used to be able to run this command in terminal and get results:
/usr/local/mysql/bin/mysql -uroot -e "SELECT * FROM table_name"
But now it returns this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I'm not sure how I even set this connection up in the first place so please any answers, pretend I'm not too savvy with this... Thanks in advance!!
First, verify that your MySQL server is running:
mysql.server start
If that was not the issue, try starting the MySQL server in safe-mode using these instructions
Okay I found out what happened. When I upgraded to Yosemite, this file disappeared or something. Anyway I had to reinstall the files. Everything is here in this link under the MySQL section:
http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/
I've been trying to work MySQL on Rails 2.3.14. I've to work with Rails2 but i can't work MySQL.
I've setup MySQL with brew according to http://www.frederico-araujo.com/2011/07/30/installing-rails-on-os-x-lion-with-homebrew-rvm-and-mysql/ this tutorial but when i tried to run
$ mysql
i've faced to
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Why?
Thank you.
All right mates.
I got it.
First I killed all mysql process
killall mysqld
and then I uninstalled mysql from brew
$brew uninstall mysql
$brew cleanup
after that I installed mysql again as http://www.frederico-araujo.com/2011/07/30/installing-rails-on-os-x-lion-with-homebrew-rvm-and-mysql/
so I fixed the problem.