CentOS7下MySQL的安裝與配置

來源:互聯網
上載者:User

標籤:local   支援   版本   clean   用戶端   change   exp   操作   community   

前述

  CentOS7預設不支援MySQL,使用yum install mysql 安裝的是mariadb,mariadb是mysql一個開源分支,所以我們需要配置新的yum源來進行MySQL的安裝

操作

  步驟1: 下載安裝MySQL的yum源(這裡版本選的5.7)

     wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm 

     yum localinstall mysql57-community-release-el7-8.noarch.rpm 

  步驟2: 清理yum緩衝: 

     yum clean all && yum makecache 

  步驟3: 按需要安裝相應的包

     yum -y install mysql-community-client  # 用戶端

     yum -y install mysql-community-server  # 服務端 

     yum -y install mysql-community-devel  # 開發庫

  步驟4: 啟動MySQL服務,需要安裝服務端 mysql-community-server

     systemctl start mysqld 

  步驟5: 設定root使用者密碼,預設密碼為空白,命令列直接敲 mysql就可以串連

     mysqladmin -u root password "newpass" 

    如提示: mysqladmin: unable to change password; error: ‘Column count of mysql.user is wrong. Expected 45, found 42. Created with MySQL 50556, now running 50722. Please use mysql_upgrade to fix this error.‘

    執行: mysql_upgrade

  步驟6: 串連MySQL

     mysql -u root -pnewpass  # 注意 -p後面不能有空格

    

CentOS7下MySQL的安裝與配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.