on MAC
Install
$ brew update
$ brew search mysql
$ brew install mysql
Start Server
$ mysql.server start
$ brew services start mysql
Set Password
$ mysql_secure_installation
Access MySQL Server
$ mysql -u root -p
Exit MySQL Server
mysql> exit
Stop Server
$ mysql.server stop
$ brew services stop mysql
Restart Server
$ mysql.server restart
$ brew services restart mysql
Uninstall
$ brew uninstall mysql
$ rm -rf /usr/local/var/mysql
$ rm /usr/local/etc/my.cnf
on Ubuntu
Install
$ sudo apt-get update
$ sudo apt-get install mysql-server -y
Start Server
$ sudo service mysqld start
$ sudo /etc/init.d/mysqld start
$ sudo systemctl start mysqld
Set Password
$ sudo mysql_secure_installation
Access MySQL Server
$ sudo mysql -u root -p
Exit MySQL Server
$ mysql> exit
Stop Server
$ sudo service mysqld stop
$ sudo /etc/init.d/mysqld stop
$ sudo systemctl stop mysqld
Restart Server
$ sudo service mysqld restart
$ sudo /etc/init.d/mysqld restart
$ sudo systemctl restart mysqld
Uninstall
$ sudo apt-get purge mysql-server mysql-common mysql-client -y
$ sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql
$ sudo rm -rf /var/log/mysql.*
$ sudo apt-get autoremove
$ sudo apt-get autoclean