CentOS7使用rpm安裝MySQL8

  1. 到官網(wǎng)下載最新的的安裝包:

    [root@study data]# wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.13-1.el7.x86_64.rpm-bundle.tar
    
  2. 卸載CentOS7自帶的MariaDB依賴:

    [root@study selinux]# rpm -qa|grep mariadb
    mariadb-libs-5.5.60-1.el7_5.x86_64
    [root@study selinux]# rpm -e --nodeps mariadb-libs
    [root@study selinux]# rpm -qa|grep mariadb
    
  3. 解壓下載的安裝包

    [root@study data]# tar -xvf mysql-8.0.13-1.el7.x86_64.rpm-bundle.tar
    
  4. 安裝net-tools

    [root@study data]# yum -y install net-tools
    
  5. 依次安裝mysql包

    [root@study data]# rpm -ivh mysql-community-common-8.0.13-1.el7.x86_64.rpm
    [root@study data]# rpm -ivh mysql-community-libs*
    [root@study data]# rpm -ivh mysql-community-client-8.0.13-1.el7.x86_64.rpm
    [root@study data]# rpm -ivh  mysql-community-server-8.0.13-1.el7.x86_64.rpm
    warning: mysql-community-server-8.0.13-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    error: Failed dependencies:
      /usr/bin/perl is needed by mysql-community-server-8.0.13-1.el7.x86_64
      perl(Getopt::Long) is needed by mysql-community-server-8.0.13-1.el7.x86_64
      perl(strict) is needed by mysql-community-server-8.0.13-1.el7.x86_64
    ### 安裝缺失的perl依賴包
    [root@study data]# yum install perl
    [root@study data]# rpm -ivh  mysql-community-server-8.0.13-1.el7.x86_64.rpm
    
  6. 啟動(dòng)mysql立帖,獲取默認(rèn)root密碼,登錄mysql數(shù)據(jù)庫

    [root@study data]# systemctl start mysqld.service
    [root@study data]# grep 'temporary password' /var/log/mysqld.log
    2018-11-16T15:15:20.149816Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: J/V3,F-pa;>X
    [root@study data]# mysql -uroot -p
    
  7. 初始化mysql

    [root@study data]# mysql_secure_installation
    
    Securing the MySQL server deployment.
    
    Enter password for user root: 
    The 'validate_password' component is installed on the server.
    The subsequent steps will run with the existing configuration
    of the component.
    Using existing password for root.
    
    Estimated strength of the password: 100 
    Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
    
    New password: $RFV5tgb
    
    Re-enter new password: $RFV5tgb
    
    Estimated strength of the password: 100 
    Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
    By default, a MySQL installation has an anonymous user,
    allowing anyone to log into MySQL without having to have
    a user account created for them. This is intended only for
    testing, and to make the installation go a bit smoother.
    You should remove them before moving into a production
    environment.
    
    Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
    Success.
    
    
    Normally, root should only be allowed to connect from
    'localhost'. This ensures that someone cannot guess at
    the root password from the network.
    
    Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
    Success.
    
    By default, MySQL comes with a database named 'test' that
    anyone can access. This is also intended only for testing,
    and should be removed before moving into a production
    environment.
    
    
    Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
    - Dropping test database...
    Success.
    
    - Removing privileges on test database...
    Success.
    
    Reloading the privilege tables will ensure that all changes
    made so far will take effect immediately.
    
    Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
    Success.
    
    All done!
    
  8. 修改root密碼棘利,新建study用戶

    ### 初始化時(shí)已更改root密碼傍妒,這里可以省略
    # mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '$RFV5tgb';
    ### 這里是避免SQLyog連接8.0報(bào):Error No.2058 Plugin caching_sha2_password could not be loaded向胡,后續(xù)工具更新后,再使用8.0新的加密方式
    mysql> CREATE USER 'study'@'localhost' IDENTIFIED WITH mysql_native_password BY '^YHN7ujm';
    ### 授予study所有權(quán)限
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'study'@'localhost' WITH GRANT OPTION;
    
  9. 用SQLyog進(jìn)行連接

    ps: 由于mysql沒有開啟遠(yuǎn)程連接千所,通過ssh連接跳轉(zhuǎn)

    1. 配置SSH Tunneling
    配置ssh
    1. 填寫mysql連接信息枷邪,注意host填:127.0.0.1
    配置mysql連接
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末起意,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子变屁,更是在濱河造成了極大的恐慌眼俊,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,104評(píng)論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件粟关,死亡現(xiàn)場(chǎng)離奇詭異疮胖,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)闷板,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,816評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門澎灸,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人蛔垢,你說我怎么就攤上這事击孩。” “怎么了鹏漆?”我有些...
    開封第一講書人閱讀 168,697評(píng)論 0 360
  • 文/不壞的土叔 我叫張陵巩梢,是天一觀的道長(zhǎng)创泄。 經(jīng)常有香客問我,道長(zhǎng)括蝠,這世上最難降的妖魔是什么鞠抑? 我笑而不...
    開封第一講書人閱讀 59,836評(píng)論 1 298
  • 正文 為了忘掉前任场斑,我火速辦了婚禮始苇,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘辫诅。我一直安慰自己法绵,他們只是感情好箕速,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,851評(píng)論 6 397
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著朋譬,像睡著了一般盐茎。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上徙赢,一...
    開封第一講書人閱讀 52,441評(píng)論 1 310
  • 那天字柠,我揣著相機(jī)與錄音,去河邊找鬼狡赐。 笑死窑业,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的枕屉。 我是一名探鬼主播常柄,決...
    沈念sama閱讀 40,992評(píng)論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼搀庶!你這毒婦竟也來了拐纱?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,899評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤哥倔,失蹤者是張志新(化名)和其女友劉穎秸架,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體咆蒿,經(jīng)...
    沈念sama閱讀 46,457評(píng)論 1 318
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡东抹,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,529評(píng)論 3 341
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了沃测。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片缭黔。...
    茶點(diǎn)故事閱讀 40,664評(píng)論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖蒂破,靈堂內(nèi)的尸體忽然破棺而出馏谨,到底是詐尸還是另有隱情,我是刑警寧澤附迷,帶...
    沈念sama閱讀 36,346評(píng)論 5 350
  • 正文 年R本政府宣布惧互,位于F島的核電站哎媚,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏喊儡。R本人自食惡果不足惜拨与,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,025評(píng)論 3 334
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望艾猜。 院中可真熱鬧买喧,春花似錦、人聲如沸匆赃。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,511評(píng)論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽炸庞。三九已至钱床,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間埠居,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,611評(píng)論 1 272
  • 我被黑心中介騙來泰國(guó)打工事期, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留滥壕,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 49,081評(píng)論 3 377
  • 正文 我出身青樓兽泣,卻偏偏與公主長(zhǎng)得像绎橘,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子唠倦,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,675評(píng)論 2 359