MySQL

Install

brew install mysql

and install to start on restart

brew services start mysql

Connect with

mysql -uroot

Show databases

show databases

Show users :

select user,host from mysql.user

Create a database with

CREATE DATABASE example;
CREATE USER 'example'@'localhost' IDENTIFIED BY 'example';
GRANT ALL PRIVILEGES ON example.* TO 'example'@'localhost';
FLUSH PRIVILEGES;

Upgrade

If you need to upgrade MySQL install :

brew upgrade mysql
mysql_upgrade -uroot --force

Run MySQL service in shell

To run in local shell without starting on restart

mysql.server start