Yum Repository自定義版本安裝Mysql

以前安裝Mysql都是要自己去網(wǎng)上選擇一個(gè)特定版本,然后再下載到服務(wù)器安裝,而且不同版本的相關(guān)命令也有所不同,學(xué)習(xí)記憶成本也非常高。現(xiàn)在官網(wǎng)可以通過安裝yum的依賴庫(kù)自由選擇安裝,非常的方便,今天來分享下。

  1. Adding the MySQL Yum Repository
sudo rpm -Uvh mysql57-community-release-el6-n.noarch.rpm
  1. Selecting a Release Series
yum repolist all | grep mysql

通過這個(gè)命令可以看到不同版本的默認(rèn)啟用情況,然后我們可以選擇自己的需要的版本,如果需要變更,需要修改/etc/yum.repos.d/mysql-community.repo的文件。

[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

例如需要啟動(dòng)Mysql5.6,則將5.7的enabled=0,將5.6的enabled=1即可。修改完后確認(rèn)最終版本:

yum repolist enabled | grep mysql
  1. Installing MySQL
sudo yum install mysql-community-server
  1. Starting the MySQL Server

Start the MySQL server with the following command:

shell> sudo service mysqld start

For EL7-based platforms, this is the preferred command:

shell> sudo systemctl start mysqld.service

You can check the status of the MySQL server with the following command:

shell> sudo service mysqld status

For EL7-based platforms, this is the preferred command:

shell> sudo systemctl status mysqld.service

查看啟動(dòng)后的初始密碼:

sudo grep 'temporary password' /var/log/mysqld.log

最后通過初試密碼登錄并且修改root的密碼:

mysql -uroot -p

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

大家喜歡可以訪問我的個(gè)人網(wǎng)站:http://www.yingminxing.com
如有疑問,歡迎溝通交流:QQ:370399195, 微信:yingminxing1988

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容