Centos7.4+Mysql8.0詳細安裝教程附安裝包
阿新 • • 發佈:2019-02-15
安裝環境:
系統:Cento7.4
Mysql版本:8.0.11
Mysql遠端連線工具:Navicat
一 建立Mysql賬戶
groupadd mysql
useradd -g mysql mysql
二 準備安裝包
mysql-community-common-8.0.11-1.el7.x86_64.rpm
mysql-community-libs-8.0.11-1.el7.x86_64.rpm
mysql-community-client-8.0.11-1.el7.x86_64.rpm
mysql-community-server-8.0 .11-1.el7.x86_64.rpm
三 安裝Mysql
安裝之前需要檢測系統是否有安裝mysql
rpm -qa | grep mysql
rpm -qa | grep mariadb
如果有使用命令進行解除安裝
rpm -e --nodeps XXX
解除安裝完成之後按照下列順序進行安裝
rpm -ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.11-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.11-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.11-1.el7.x86_64.rpm
報錯1
error: Failed dependencies: /usr/bin/perl is needed by
mysql-community-server-8.0.11-1.el7.x86_64 perl(Getopt::Long) is
needed by mysql-community-server-8.0.11-1.el7.x86_64 perl(strict)解決1
yum install perl
四 初始mysqld –initialize啟動資料庫
systemctl start mysqld
六 檢視初始化密碼
vim /var/log/mysqld.log
;%WTMdmz0b#a
七 連結Mysql
mysql -uroot -p
密碼為上一步找到的初始化密碼
八 重置密碼
ALTER USER 'root'@'localhost' IDENTIFIED BY 'a123456';
九 開啟遠端連線許可權
CREATE USER 'admin'@'%' IDENTIFIED BY 'a123456';
grant all on *.* to 'admin'@'%';
flush PRIVILEGES;
十 連線報錯
因為mysql8.0改變了加密方式,使用下面的命令即可解決問題
ALTER USER 'admin'@'%' IDENTIFIED BY 'a123456' PASSWORD EXPIRE NEVER;
ALTER USER 'admin'@'%' IDENTIFIED WITH mysql_native_password BY 'a123456';
FLUSH PRIVILEGES;