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.
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 upgrade OS X to High Sierra.
After upgrade, I found some services does not working correctly, which uses MySQL.
I try to connect by
mysql -u root -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
So I try to restart mysql service by
brew services start mysql
Could not find domain for
Error: Failure while executing; `/bin/launchctl enable gui/503/homebrew.mxcl.mysql` exited with 112.
mysql.server start
ERROR! The server quit without updating PID file (/usr/local/var/mysql/mangoui-Mac-mini.local.pid).
/usr/local/var/mysql/mangoui-Mac-mini.local.err
2018-07-27T05:32:37.570411Z 0 [ERROR] [MY-011071] [Server] /usr/local/opt/mysql/bin/mysqld: Error while setting value 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' to 'sql_mode'
Interesting point is
sudo brew services start mysql
command works.
So I tried
sudo mysql -u root -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
still get same error.
Please note that brew has recently upgraded mysql to 8.0, which causes some things to break due to deprecations (in my case 'sql_mode').
If you want to stay with 8.0, you can have a look at:
https://dev.mysql.com/doc/refman/8.0/en/upgrading.html
which will guide you through.
If you (for instance for compatibility reasons) decides to stay with e.g. 5.7 you can do e.g.:
> brew services stop mysql
> brew switch mysql 5.7.21
> brew services start mysql
> brew pin mysql # Tell brew to stay on this version
To see which version you have installed you can type:
> brew list --versions mysql
Good luck! Hope this helps :-)
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 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