安裝依賴
? ? ? ? ? ?yum install libaio wget -y
查看是否已經(jīng)安裝mysql,若已安裝先卸載
????????yum list installed |grep mysql
下載
? ? ? ? wget http://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
????????yum localinstall mysql80-community-release-el7-1.noarch.rpm
查看是否下載成功
? ? ? ? ?yum repolist enabled |grep "mysql.*-community.*"
安裝
????????yum install mysql-community-server -y
? ? ? ? 提示Complete!后安裝成功
查看安裝目錄
? ??????whereis mysql
啟動服務(wù)
? ??????????systemctl start mysqld
查看mysql進程
? ? ? ? ? ?ps -ef | grep mysql
也可以查詢mysql狀態(tài)
? ?????????systemctl?status?mysqld
設(shè)置開機啟動項
? ? ? ? ? ?systemctl enable mysqld
查看初始密碼
? ? ? ? /cat/var/log/mysqld.log |grep password
進入mysql
? ? ? ? mysql -u root? -p
修改密碼
? ? ? ? ?ALTER USER 'root'@'localhost' IDENTIFIED BY'12345678‘;
? ? ? ? 這時會報錯,是因為mysql密碼安全策略問題
? ? ? ? ? ? 解決辦法:
????????????????先把密碼修改為復(fù)雜密碼两芳,如ALTER USER 'root'@'localhost' IDENTIFIED BY'mysql_123MYSQL';
? ??????????????set global validate_password.policy=0;
? ??????????????set global validate_password.policy=0;
? ? ? ? ? ? ? ? 修改成功后著角,再把密碼修改為想要的簡單密碼ALTER USER 'root'@'localhost' IDENTIFIED BY'12345678';
刷新權(quán)限表
? ? ? ? ? ?flush privileges;
navicat可能還連接失敗
? ??????????use mysql;
? ??????????update user set host='%'where user='root';
? ??????????ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123';
? ??????????flush privileges;