MySQL

Install

brew install mysql
brew cask install mysqlworkbench

and install to start on restart

brew services start mysql

Connect with
mysql -u root
Or connect with host name

mysql -h 127.0.0.1 -u root -p    

Show databases
show databases;
Show tables
use myDb; show tables;

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