Linux下yum安裝MySQL 5.7.xx
阿新 • • 發佈:2019-02-03
//系統
# cat /etc/redhat-release
CentOS release 6.8 (Final)
# uname -r
2.6.32-642.el6.x86_64
//下載安裝rpm源包 # wget https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm # rpm -ivh mysql57-community-release-el6-9.noarch.rpm //或 # yum localinstall -y mysql57-community-release-el6-9.noarch.rpm //安裝MySQL # yum -y install mysql-community-server //初始的'root'@'localhost'密碼會被儲存在/var/log/mysqld.log //檢視初始密碼 # grep 'temporary password' /var/log/mysqld.log //啟動 # /etc/init.d/mysqld start //登入 # mysql -uroot -p
//修改初始密碼
//要注意的是MySQL 5.7預設不能設定簡單密碼,需要包含字母大小寫特殊字元,長度8位或以上
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'myNewPass18#';
//授權遠端登入,若要精準授權把 % 更換為ip或網段地址即可
mysql>grant all privileges on *.* to 'slave'@'%' identified by 'myNewPass20#';
mysql>flush privileges;