Linux學習之安裝mysql

來源:互聯網
上載者:User

本篇中主要學習使用原始碼來安裝mysql:

下載mysql源碼包,放置到/usr/local/src,假設我的源碼包叫:mysql.5.1.tar.gz

 

先建立一個使用者組和一個使用者

groupadd mysql //建立mysql使用者組
useradd -g mysql mysql  //建立mysql帳戶

下面開始安裝:

1、解壓源碼包

tar -zxvf mysql.5.1.tar.gz

2、進入解壓包中

然後進行安裝軟體三部曲:configure,make,make install

./configure --prefix=/usr/local/mysql  -with-charset=gbk

 

make clean ;make(其中make clean 可以不要,最好還是帶上)

 

make install

 

3、cp support-files/my-medium.cnf /etc/my.cnf  //拷貝my-medium.cnf檔案到/etc/目錄下並重新命名為my.cnf

4、用編輯器開啟my.cnf檔案,找到log-bin=mysql-bin這一行,將其注釋掉

:#log-bin=mysql-bin

5、進入安裝目錄:

bin/mysql_install_db --user=mysql
6、設定目錄許可權

chown -R root .  //設定目錄許可權屬性
chown -R mysql /usr/local/mysql/var
chgrp -R mysql .
bin/mysqld_safe --user=mysql &  //啟動mysql

 

 

7、將/usr/local/mysql/bin 加入環境變數中

8 、執行mysql -uroot 如果登入成功,則安裝成功。

聯繫我們

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