Install MySql Server 5.7(或8.0) by YUM in Centos 7

詳細安裝步驟參見官方文檔:
https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html

1. 先下載MySQL Yum Repository
wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm

2.Install the downloaded release package
sudo yum localinstall mysql80-community-release-el7-1.noarch.rpm;

3. 編輯mysql-community.repo, 將enable 5.7, disable 8.0

8.0默認是enabled,其它版本默認是disabled.(enabled=0為disabled,1為enabled,其它的不要修改)
vim /etc/yum.repos.d/mysql-community.repo

# Enable to use MySQL 5.7

[mysql57-community]

name=MySQL 5.7 Community Server

baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[mysql80-community]

name=MySQL 8.0 Community Server

baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

4. 查看當前enbled的版本是否正確:

yum repolist enabled | grep mysql

5. 安裝MySql-Server

shell> sudo yum install mysql-community-server

6. Start the MySql-Server

Start the MySQL server with the following command:

shell> sudo service mysqld start?

Starting mysqld:[OK]

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

shell> sudo service mysqld status

mysqld(pid 3066)is running.

At the initial start up of the server, the following happens, given that the data directory of the server is empty:

The server is initialized.

SSL certificate and key files are generated in the data directory.

validate_password?is installed and enabled.

A superuser account?'root'@'localhost?is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command:

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

Change the root password as soon as possible by logging in with the generated, temporary password and set a custom password for the superuser account:

shell> mysql -uroot -p

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

Note

validate_password?is installed by default. The default password policy implemented by?validate_passwordrequires that passwords contain at least one upper case letter, one lower case letter, one digit, and one special character, and that the total password length is at least 8 characters.

最后編輯于
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末递雀,一起剝皮案震驚了整個濱河市闲先,隨后出現(xiàn)的幾起案子诵闭,更是在濱河造成了極大的恐慌枯夜,老刑警劉巖捕犬,帶你破解...
    沈念sama閱讀 218,941評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件米死,死亡現(xiàn)場離奇詭異具垫,居然都是意外死亡,警方通過查閱死者的電腦和手機树绩,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,397評論 3 395
  • 文/潘曉璐 我一進店門萨脑,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人饺饭,你說我怎么就攤上這事渤早。” “怎么了砰奕?”我有些...
    開封第一講書人閱讀 165,345評論 0 356
  • 文/不壞的土叔 我叫張陵蛛芥,是天一觀的道長。 經(jīng)常有香客問我军援,道長,這世上最難降的妖魔是什么雪标? 我笑而不...
    開封第一講書人閱讀 58,851評論 1 295
  • 正文 為了忘掉前任甘凭,我火速辦了婚禮紫岩,結果婚禮上,老公的妹妹穿的比我還像新娘空厌。我一直安慰自己庐船,他們只是感情好,可當我...
    茶點故事閱讀 67,868評論 6 392
  • 文/花漫 我一把揭開白布嘲更。 她就那樣靜靜地躺著筐钟,像睡著了一般。 火紅的嫁衣襯著肌膚如雪赋朦。 梳的紋絲不亂的頭發(fā)上篓冲,一...
    開封第一講書人閱讀 51,688評論 1 305
  • 那天,我揣著相機與錄音宠哄,去河邊找鬼壹将。 笑死,一個胖子當著我的面吹牛毛嫉,可吹牛的內(nèi)容都是我干的诽俯。 我是一名探鬼主播,決...
    沈念sama閱讀 40,414評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼承粤,長吁一口氣:“原來是場噩夢啊……” “哼暴区!你這毒婦竟也來了?” 一聲冷哼從身側響起辛臊,我...
    開封第一講書人閱讀 39,319評論 0 276
  • 序言:老撾萬榮一對情侶失蹤仙粱,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后浪讳,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體缰盏,經(jīng)...
    沈念sama閱讀 45,775評論 1 315
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,945評論 3 336
  • 正文 我和宋清朗相戀三年淹遵,在試婚紗的時候發(fā)現(xiàn)自己被綠了口猜。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,096評論 1 350
  • 序言:一個原本活蹦亂跳的男人離奇死亡透揣,死狀恐怖济炎,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情辐真,我是刑警寧澤须尚,帶...
    沈念sama閱讀 35,789評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站侍咱,受9級特大地震影響耐床,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜楔脯,卻給世界環(huán)境...
    茶點故事閱讀 41,437評論 3 331
  • 文/蒙蒙 一撩轰、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦堪嫂、人聲如沸偎箫。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,993評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽淹办。三九已至,卻和暖如春恶复,著一層夾襖步出監(jiān)牢的瞬間怜森,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,107評論 1 271
  • 我被黑心中介騙來泰國打工寂玲, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留塔插,地道東北人。 一個月前我還...
    沈念sama閱讀 48,308評論 3 372
  • 正文 我出身青樓拓哟,卻偏偏與公主長得像想许,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子断序,可洞房花燭夜當晚...
    茶點故事閱讀 45,037評論 2 355