Skip to content

Instantly share code, notes, and snippets.

@matheus-santos
Last active May 6, 2019 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matheus-santos/b9900b2d75f9c8f3cd69f4e200da5be8 to your computer and use it in GitHub Desktop.
Save matheus-santos/b9900b2d75f9c8f3cd69f4e200da5be8 to your computer and use it in GitHub Desktop.
Install mysql Mac

Used brew's remove & cleanup commands, unloaded the launchctl script, then deleted the mysql directory in /usr/local/var, deleted my existing /etc/my.cnf (leave that one up to you, should it apply) and launchctl plist

Updated the string for the plist. Note also your alternate security script directory will be based on which version of MySQL you are installing.

Step-by-step:

brew remove mysql
brew cleanup
launchctl unload -w /usr/local/Cellar/mysql/8.0.16/homebrew.mxcl.mysql.plist
rm /usr/local/Cellar/mysql/8.0.16/homebrew.mxcl.mysql.plist
sudo rm -rf /usr/local/var/mysql

I then started from scratch:

installed mysql with brew install mysql ran the commands brew suggested: (see note: below)

./usr/local/Cellar/mysql/8.0.16/bin/mysql_secure_installation

Start mysql with mysql.server start command, to be able to log on it

Used the alternate security script:

Followed the launchctl section from the brew package script output such as,

#start
launchctl load -w /usr/local/Cellar/mysql/8.0.16/homebrew.mxcl.mysql.plist

#stop
launchctl unload -w /usr/local/Cellar/mysql/8.0.16/homebrew.mxcl.mysql.plist

Faq

PID file not found!

Add the following to my.cnf:

pid-file    = /usr/local/var/run/mysqld/mysqld.pid

Create the directory/file:

mkdir /usr/local/var/run/mysqld
touch /usr/local/var/run/mysqld/mysqld.pid
chown -R mysql:mysql /usr/local/var/run/mysqld

Find my.cnf

To find my.cnf, you may run mysql --help | grep cnf to find possible options. Alternatively you can configure the connection in MySQL Workbench by accessing Database > Manage connections > [Select connection on left side] > System Profile > Configuration File.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment