CentOS 7安裝Mysql5.6.37

CentOS 7不帶Mysql數據庫了,默認的數據庫是MariaDB(Mysql的一個分支)。
安裝mysql的話會和mariadb的文件衝突,所以需要先卸載掉mariadb

具體步驟:

  1. 卸載mariadb
    rpm -qa|grep mariadb
    rpm -e –nodeps mariadb-libs-5.5.37-1.el7_0.x86_64

  2. 下載rpm安裝文件
    wget http://repo.mysql.com/mysql-community-release-el7.rpm

  3. 執行rpm安裝
    rpm -ivh mysql-community-release-el7.rpm

  4. yum install mysql-server

  5. 安裝完成後,啓動Mysql。
    systemctl start mysqld.service
    初始無密碼

  6. 設置root密碼。
    update user set password=password(“123456”) where user=’root’;

  7. 設置遠程訪問
    grant all privileges on . to ‘root’@’%’ identified by ‘root’ with grant option;
    flush privileges;

  8. 開機自啓動(非必須)。
    systemctl enable mysqld.service

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章