https://dev.mysql.com/downloads/repo/yum/mysql
wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
安裝MySql源sql
yum -y install mysql57-community-release-el7-11.noarch.rpm
查看一下安裝效果數據庫
yum repolist enabled | grep mysql.*
yum install mysql-community-server
中間會彈出是與否的選擇,選擇y便可,而後耐心等待吧。。。。。。。安全
systemctl start mysqld.service
運行一下命令查看一下運行狀態服務器
systemctl status mysqld.service
查看一下初始密碼ui
grep "password" /var/log/mysqld.log
登陸插件
mysql -uroot -p
修改密碼code
ALTER USER 'root'@'localhost' IDENTIFIED BY '****************';
mysql默認安裝了密碼安全檢查插件(validate_password),默認密碼檢查策略要求密碼必須包含:大小寫字母、數字和特殊符號,而且長度不能少於8位。
不然會提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements錯誤server
數據庫沒有受權,只支持localhost本地訪問ip
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
//遠程鏈接數據庫的時候須要輸入用戶名和密碼
用戶名:root
密碼:123456
指點ip: %表明全部Ip,此處也能夠輸入ip來指定ip
輸入後使修改生效還須要下面的語句
mysql>FLUSH PRIVILEGES;
也能夠經過修改表來實現遠程:
mysql -u root -p mysql> use mysql; mysql> update user set host = '%' where user = 'root'; mysql> select host, user from user;
systemctl enable mysqld
systemctl daemon-reload