Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL is not found anywhere on computer

I have recently installed MySQL directly from the website (mysql-5.7.9-osx10.10-x86_64.dmg) and I have run into a great deal of difficulty that started with trying to change the given password. The error that was returned was:

[Warning] Using a password on the command line interface can be insecure. mysqladmin: connect to server at 'localhost' failed error: Can't connect to local MySQL server through socket '/tmp/mysql.sock (2)' Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

From here I attempted to find the "usr" folder (hidden files are showing) or even anything that closely resembles MySQL anywhere on my computer and got nothing except for installation .dmg files.

I know that MySQL was installed because it is now able to be started and stopped in the System Preferences pane, but clearly none of my commands are working and I keep getting this error no matter what I do:

mysql: command not found

Can someone give me some clue as to what I am missing? I've become fairly desperate and can't figure out what I am doing wrong. I am running El Capitan.

like image 914
computersciencestudent Avatar asked Apr 13 '16 22:04

computersciencestudent


People also ask

How do I fix MySQL not found Mac?

Open macOS system preferences and select the MySQL preference panel, and then execute Start MySQL Server. Or, manually load the launchd file. To configure MySQL to automatically start at bootup, you can: $> sudo launchctl load -w com.

Why MySQL command is not working?

The mysql Command not found error occurs because your computer can't find a program associated with the command on your computer's PATH environment variable. The PATH environment variable is a list of directories specifying where your computer should look for a program to run from the Terminal.

How do I know if MySQL is running?

We check the status with the systemctl status mysql command. We use the mysqladmin tool to check if MySQL server is running. The -u option specifies the user which pings the server. The -p option is a password for the user.


1 Answers

Well, if you're saying that MySQL is running, you can try looking for it via terminal command like this:

ps aux | grep mysql

which should give something like

12345 ... 5 Apr16 9:09.32 /usr/local/Cellar/mysql/5.6.17/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.17 --datadir=/usr/local/var/mysql --bind-address=127.0.0.1 

so basedir and datadir is probably the most valuable outputs here (please note that your path most likely will be different).

On top of it, in order to get mysql command running through terminal you have two options

  1. Create simulink from mysql's basedir into your /usr/local/bin directory

    ln -s /usr/local/Cellar/mysql/5.6.17/bin/mysql /usr/local/bin/mysql

  2. Add mysql's basedir/bin to your path (need to add this to your ~/.bashrc to make it persistent)

    export PATH=/usr/local/Cellar/mysql/5.6.17/bin/:$PATH

    New terminal tab is required for these changes to catch up.

Cheers.

like image 141
Igor Grunskiy Avatar answered Oct 13 '22 23:10

Igor Grunskiy