1.下載yum源:
wget 'https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm'
2.安裝yum源
rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
3.查看有哪些版本的mysql
yum repolist all | grep mysql
4.安裝
yum install -y mysql-community-server
5.命令
啟動:systemctl start mysqld
停止:systemctl stop mysqld
查看狀態(tài):systemctl status mysqld
6.查看默認(rèn)密碼
grep 'temporary password' /var/log/mysqld.log
7.修改密碼
SET PASSWORD = PASSWORD('Admin123!');
8.設(shè)置遠(yuǎn)程可以登錄
GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'Admin123!' WITH GRANT OPTION;
GRANT 【權(quán)限內(nèi)容】 ON 【庫名】.【表名】?TO 【用戶名】@'【IP地址】'?IDENTIFIED BY?'【密碼】'?WITH GRANT OPTION;
8.常用命令
mysql -u root -p ?連接數(shù)據(jù)庫