Install Mysql 8.0 under Mac

Before Macthe installed Mysql 8.0time and Mysql 5.7there are not the same place, where my own installation process is simple and record it.

Install brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install Mysql 8.0

brew install mysql

mysql.server start

mysql_secure_installation 

mysql -uroot -p

mysql> select host,user,plugin from mysql.user;

flush privileges;

Start, stop, restart

mysql.server start
mysql.server stop
mysql.server restart

change Password

use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';
FLUSH PRIVILEGES;

Delete MySql

brew uninstall mysql

brew cleanup

sudo rm /usr/local/mysql

sudo rm -rf /usr/local/mysql*

sudo rm -rf /Library/StartupItems/MySQLCOM

sudo rm -rf /Library/PreferencePanes/My*

sudo vim /etc/hostconfig (ps:需要删除其中的MYSQLCOM=-YES-)

sudo rm -rf ~/Library/PreferencePanes/My*

sudo rm -rf /Library/Receipts/mysql*

sudo rm -rf /Library/Receipts/MySQL*

sudo rm -rf /var/db/receipts/com.mysql.*

Add account

CREATE USER 'sampadm'@'localhost' IDENTIFIED BY 'secret';

Empower

GRANT ALL ON sampdb.* TO 'sampadm'@'localhost';

Guess you like

Origin blog.csdn.net/yilovexing/article/details/107381488