For a newbie: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

error 2002 (hy000): can't connect to local mysql server through socket '/tmp/mysql.sock' (2)
error! the server quit without updating pid file
error: formula `mysql` is not installed.
error! mysql server pid file could not be found!
error 2003 (hy000): can't connect to mysql server on '127.0.0.1' (61)
error 2002 (hy000) mariadb
error 2002 (hy000): can't connect to mysql server on (115)
brew install mysql

I installed MySQL on Mac OS X Mountain Lion with homebrew install mysql, but when I tried mysql -u root I got the following error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

What does this error mean? How can I fix it?

It's probably because MySQL is installed but not yet running.

To verify that it's running, open up Activity Monitor and under "All Processes", search and verify you see the process "mysqld".

You can start it by installing "MySQL.prefPane".

Here is the complete tutorial which helped me: http://obscuredclarity.blogspot.in/2009/08/install-mysql-on-mac-os-x.html

Cannot find mysql.sock, file will not be created until the server is started. Find answers to Newbie just installed MySQL, ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) from the expert community at Experts Exchange

You'll need to start MySQL before you can use the mysql command on your terminal. To do this, run brew services start mysql. By default, brew installs the MySQL database without a root password. To secure it run: mysql_secure_installation.

To connect run: mysql -uroot. root is the username name here.

ERROR 2002 (HY000): Can't connect to local , It's probably because MySQL is installed but not yet running. To verify that it's running, open up Activity Monitor and under "All Processes",  Hi Friends, In this video we are going to see a very easy solution for Mysql server socket error, Most of the time mysql service won't start due to this erro

This happened after the homebrew install and occurs due to permission issues. The following commands fixed the issue.

sudo chown -R _mysql:mysql /usr/local/var/mysql

sudo mysql.server start

For a newbie: ERROR 2002 (HY000): Can't connect to local , For a newbie: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'. I installed MySQL on Mac OS X  I installed (on Ubuntu 13) MYSQL using sudo apt-get install mysql But after running mysql -u root -p and entering the password it gives the error ERROR 2002 (HY000

Run: brew info mysql

And follow the instructions. From the description in the formula:

Set up databases to run AS YOUR USER ACCOUNT with:
    unset TMPDIR
    mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysql_install_db:
    mysql_install_db --help

and view the MySQL documentation:
  * http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html
  * http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html

Hope this helps.

For a newbie: ERROR 2002 (HY000): Can't connect to local MySQL , For a newbie: ERROR 2002 (HY000): Can't connect to local MySQL - 23 Answers​. It's probably because MySQL is installed but not yet running. To verify that it's  i was trying to access remotly to mysql mariaDB this is my my.cnf file # # This group is read both both by the client and the server # use it for options that affect everything # [client-server] # # include all files from the config directory #

As others have pointed out this is because MySQL is installed but the service isn't running. There are many ways to start the MySQL service and what worked for me is the below.

To start the service:

  1. Go to "System Preference"
  2. At the bottom pane there should be MySql icon.
  3. Double click that to launch the 'MySQL Server Status' and press the button 'Start MySQL Server'

My env:

Mac Yosemite 10.10.3

Installed Package: /Volumes/mysql-advanced-5.6.24-osx10.8-x86_64

ERROR 2002 (HY000): Can't connect to local MySQL srever through , error 2002 (hy000): can't connect to local mysql server through socket '/var/run/​mysqld Duration: 2:27 Posted: Jan 1, 2018 I installed MySQL on Mac OS X Mountain Lion with homebrew install mysql, but when I tried mysql -u root I got the following error: ERROR 2002 (HY000): Can't connect to local MySQL server through

MySQL Error, ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/​lib/mysql/mysql.sock' (13). I searched @ google and I found  Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features.

ERROR 2002 (HY000): Can't connect to local MySQL server through , Newbie here so bear with me I installed mariadb but I simply can't start ERROR 2002 (HY000): Can't connect to local MySQL server through  ramanasharma@ramana:~$ mysql --version mysql Ver 14.14 Distrib 5.7.26, for Linux (x8664) using EditLine wrapper ramanasharma@ramana:~$ mysql -uroot -proot0 mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 2002 (HY

ERROR 2002 (HY000): Can't connect to local MySQL server , pi@raspberrypi:~ $ sudo mysql start ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'  ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.so Hi i get the following eroor when trying to start mysql /usr/local/mysql/bin/mysql

Comments
  • Didn't post it as an answer but you have to install mysql-server package aswell, not just mysql
  • @HankyPanky maybe that was true when you wrote it. But in 2016 Brew has no mysql-server to install.
  • It's important to note that you installed using Homebrew so ignore the non-homebrew tips and start (and restart on startup) with brew services start mysql or (if you don't want a background service) mysql.server start.
  • I got it to work but with old normal mysql 5.7.19. The new mysql@5.7 version 5.7.24 couldn't work because the some config reference was kept linked to the old mysql instead of the new brew Cellar mysql@5.7 Keg. So thanks I try this later
  • This error is also likely to happen after running brew upgrade which will install a newer version of mysql than previously installed.
  • I just ran mysqld and that was all, this was an issue caused by poor shutting down due to a sort of hard reset/shut-down of the system.
  • None of the suggested methods worked. For me, it was running, however, there was a permission issue. Running sudo chown -R _mysql:mysql /usr/local/var/mysql && sudo brew services restart mysql@5.7 solved the issue
  • When looking in Activity Monitor, the mysqlId is running; to work around this just stop mysql then restart it.
  • Running sudo chown -R _mysql:mysql /usr/local/var/mysql && sudo brew services restart mysql@5.7 solved the issue
  • For those wondering mysql_secure_installation is a mariaDB specific script.
  • brew services start mysql success. But when I run mysql -uroot after it, still the same error.
  • you are awesome @nirojan, I was hitting my head to the wall :thumsup:
  • Cool. I can solve my problem when change to another mac admin account :)