user6013577
user6013577

Reputation:

MySQL - Can't connect to local MYSQL server...ERROR 2002?

Hi I've looked all over the internet to find an answer to this problem but nothing seems to work. I get the below problem when I try to log in to mysql on terminal in OSX El Capitan.

The server is running.

enter image description here

What should I do, I've spent 5 hours trying to figure this out before posting this. I cannot find the my.cnf file in /etc and I'm not sure what to do with it. Someone please help.

Edit:

I've downloaded and installed(just double clicking - no terminal) this: enter image description here

When everything is installed and i go into /usr/local/mysql/bin/ and try mysql -u root -p I get the following error: enter image description here

This is my my.cnf file in /etc: enter image description here

When I do sudo /usr/local/mysql/bin/mysqld_safe I get this:

enter image description here

df -h returns this, could it be something to do with space? enter image description here

Upvotes: 0

Views: 2185

Answers (1)

Steve Moore
Steve Moore

Reputation: 168

If you feel more comfortable installing it through the GUI here is an instruction guide on how to do that.

http://dev.mysql.com/doc/refman/5.7/en/osx-installation-pkg.html

Make sure you install the MySQLStartupItem.pkg and MySQL.prefPane. After you have done that you can verify your installation by opening up Terminal and running:

cd /usr/local

hitting enter then typing:

ls

hit enter again and verify the existence of two directories, one will just be MySQL and the other will be MySQL-(version number you installed).

At this stage I would restart your computer and then on restart the mysql server will start up.

Once it's restarted fire up terminal window again and type this:

/usr/local/mysql/bin/mysql -u root -p

EDIT

Open your /etc/my.cnf file and edit these two configurations.

[mysqld]
socket=/var/mysql/mysql.sock

[client]
socket=/var/mysql/mysql.sock

Hope this helps.

Upvotes: 1

Related Questions