Centos 6.7 安裝 mysql 5.7.12

來源:互聯網
上載者:User

標籤:設定檔   mysql   local   文章   使用者   

    深夜了,之所以還要寫這篇文章確實是因為今天很多時間浪費在這個mysql的安裝上,本來很簡單的過程,卻差不多浪費了一天的時間。

一、Mysql 安裝與啟動

    準備工作

(1)建立使用者

    useradd -s /sbin/nologin -M mysql

(2)建立mysql的目錄

    mkdir -p /data/mysql

(3)目錄所有者

    chown -R mysql /data/mysql


    1.下載最新的mysql 

650) this.width=650;" src="http://s2.51cto.com/wyfs02/M00/82/3E/wKiom1dPJz-T48UTAAE9Eth5r90711.jpg-wh_500x0-wm_3-wmp_4-s_1132967609.jpg" title="QQ20160602021923.jpg" alt="wKiom1dPJz-T48UTAAE9Eth5r90711.jpg-wh_50" />

    2.檔案傳輸到centos的 /usr/local/src/

    3.解壓mysql、移動

    tar -zxvf mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz

    mv mysql-5.7.12-linux-glibc2.5-x86_64 /usr/local/mysql

    4.設定檔 以及 開機檔案的複製

    cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

    cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

    5.修改設定檔

    vim /etc/my.cnf

    basedir = /usr/local/mysql

    datadir = /data/mysql

    6.啟動mysql

    /etc/init.d/mysqld start

二、可能遇到的問題

    Starting MySQL... ERROR! The server quit without updating PID file...

   (1) 可能是因為mysql沒有 指定設定檔 時會使用/etc/my.cnf設定檔,

     cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

     請開啟這個檔案查看在[mysqld]下有沒有指定資料目錄(datadir)。

      解決方案:請在[mysqld]下設定這一行:datadir = /data/mysql

   (2)可能是/data/mysql 資料目錄mysql使用者沒有許可權    

     chown -R mysql /data/mysql

    

Centos 6.7 安裝 mysql 5.7.12

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.