Linux版本: CentOS 7.4 64位
在MySQL官網(wǎng)找到適合自己平臺(tái)的MySQL Yum Repository,查看平臺(tái)信息命令 uname -a
下載:
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
安裝:
rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
使用yum安裝MySQL:
yum install mysql-community
在安裝的過程中會(huì)遇到兩次Is this ok ,寫y即可
Is this ok [y/d/N]: y
安裝完成,啟動(dòng)MySQL:
service mysqld start
MySQL5.7安裝完成后會(huì)有一個(gè)臨時(shí)密碼, 查看方式如下:
grep 'temporary password' /var/log/mysqld.log

查看MySQL臨時(shí)密碼
登錄MySQL
mysql -uroot -p
修改MySQL的root用戶密碼:
alter user 'root'@'localhost' identified by 'new_password' password expire never;
使用Navicat遠(yuǎn)程連接時(shí)提示:host is not allowed to connect mysql,解決方法:
修改root用戶的host, 先執(zhí)行一下更新語(yǔ)句
update user set host='%' where user='root' and host='localhost';
然后執(zhí)行(必須):
flush privileges;
然后重新連接可以成功。