Show Menu
Cheatography

MySQL on MacOS Cheat Sheet (DRAFT) by

At times we need to get a database, saving steps here.

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Instal­lation

brew update
brew install mysql

Secure after install

mysql_­sec­ure­_in­sta­llation
MySQL comes with a script that helps you secure your instal­lation. Run the following command and follow the on-screen prompts
 
This script will prompt you to set a root password, remove anonymous users, disallow root login remotely, and remove the test database.

Uninstall

brew uninstall mysql
 

Starting MySQL As A Service

Start MySQL Service
brew services start mysql
Stop MySQL Service
brew services stop mysql

Start MySQL only when you need it

mysqld start
start the daemon that way the service is not always running.
mysqld stop

Log into MySQL

mysql

Troubl­esh­ooting

is MySQL running?
ps aux | grep mysql