下載地址
https://downloads.mysql.com/archives/community

image.png
輸入密碼:1qaz2wsxm

image.png
進(jìn)入終端登陸mySql
/usr/local/mysql/bin/mysql -u root -p
配置環(huán)境變量后不需要加路徑
cd ~
#編輯.bash_profile
vim .bash_profile
#設(shè)置環(huán)境變量
export PATH=$PATH:/usr/local/mysql/bin
export PATH=$PATH:/usr/local/mysql/support-files
#重新加載.bash_profile
source .bash_profile
MySQL 啟動(dòng)、停止、查看狀態(tài)命令
#啟動(dòng)MySQL服務(wù)
sudo mysql.server start
#停止MySQL服務(wù)
sudo mysql.server stop
#重啟MySQL服務(wù)
sudo mysql.server restart
#查看MySQL服務(wù)狀態(tài)
sudo mysql.server status
登陸MySQL
mysql -u root -p
輸入之前設(shè)置的密碼 1qaz2wsx

image.png
創(chuàng)建用戶名密碼
#創(chuàng)建一個(gè)名為pengkang的用戶名密碼為1qaz2wsx
insert into mysql.user(Host,User,Password) values("localhost","pengkang",password("1qaz2wsx"));