需求
對於數據庫我們經常使用,使用源碼包安裝太費時間了,在網絡較好的情況下。建議使用yum在線安裝MySQL,非常方便!
安裝環境
1.CentOS 7
2.關閉防火牆,增強性
3.可連接外網
安裝步驟
下載mysql源安裝包
yum -y install wget
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
安裝mysql源
yum localinstall mysql57-community-release-el7-8.noarch.rpm
檢測源是否安裝成功
yum repolist enabled | grep "mysql.-community."
安裝mysql服務
yum install mysql-community-server
安裝版本控制(可選)
vim /etc/yum.repos.d/mysql-community.repo
啓動mysql服務
systemctl start mysqld
systemctl status mysqld
設置開機啓動
systemctl enable mysqld
systemctl daemon-reload #重載服務
查看密碼
grep 'temporary password' /var/log/mysqld.log
重設密碼
mysql -uroot -p
set password for 'root'@'localhost'=password('mypass@123#!');
實現遠程登錄
grant all privileges on . to 'root'@'%' identified by 'abc123' with grant option; #設置權限
flush privileges;