LAMP中mysql的安裝步驟

來源:互聯網
上載者:User

標籤:資料庫檔案   mysql   local   使用者   命名   lamp   

一.在/usr/locar/src/下,把下載的源碼包下載到該目錄上

下載源碼包:wget http://mirrors.sohu.com/      ///在該網址下下載MySQL源碼包

初始化:

1.解壓:tar -xvzf mysql-5.1.73-linux-i686-glibc23.tar.gz

2.移動位置並重新命名:mv mysql-5.1.73-linux-i686-glibc23  /usr/local/mysql

3.建立MySQL使用者(不讓它登入):useradd -s /sbin/nologin   mysql

4.進入MySQL目錄:cd  /usr/local/mysql

5.在根下建立目錄(資料庫檔案會放到這裡面):mkdir  -p  /data/mysql

6.修改許可權(屬主屬組):chown  -R  mysql   /data/mysql

7.在/usr/local/mysql下編譯:

./scripts/mysql_install_db  --user=mysql  --datadir=/data/mysql

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/8A/CE/wKiom1g8O1eC6uGxAABNZBK_6Ik187.png-wh_500x0-wm_3-wmp_4-s_763189486.png" title="clipboard.png" alt="wKiom1g8O1eC6uGxAABNZBK_6Ik187.png-wh_50" />

 --user定義資料庫的所屬主,--datadir定義資料庫安裝到哪裡

二 . 配置mysql

1.拷貝設定檔:cp  support-files/my-large.cnf   /etc/my.cnf

650) this.width=650;" src="http://s5.51cto.com/wyfs02/M02/8A/CE/wKiom1g8O4CSRzoaAABIh5CWLtA428.png-wh_500x0-wm_3-wmp_4-s_1702010598.png" title="clipboard.png" alt="wKiom1g8O4CSRzoaAABIh5CWLtA428.png-wh_50" />

2.拷貝啟動指令檔並修改其屬性:cp support-files/mysql.server  /etc/init.d/mysqld

650) this.width=650;" src="http://s5.51cto.com/wyfs02/M00/8A/CE/wKiom1g8O6fSqh9wAABIg8ahCoU873.png-wh_500x0-wm_3-wmp_4-s_1202209650.png" title="clipboard.png" alt="wKiom1g8O6fSqh9wAABIg8ahCoU873.png-wh_50" />

vim  /etc/init.d/mysqld

要修改的地方:datadir和basedir

改為:datadir=/data/mysql (前面 初始化資料庫時定義的目錄)

         basedir=/usr/local/mysql/ (mysql程式檔案存放的地方)

3.把啟動指令碼加入系統服務項,設定開機啟動並啟動mysql:

chkconfig  --add  mysqld

chkconfig   mysqld  on

chkconfig --list  mysqld

service mysqld start

查看有無啟動:ps  aux | grep mysqld

至此,mysql安裝完畢!



常見的一些錯誤:/usr/local/mysql/bin/mysqld: error while loading shared libraries:libstdc++.so.5:cannot open shared object file:

解決方案:yum install -y compat-libstdc++-33

本文出自 “11842333” 部落格,轉載請與作者聯絡!

LAMP中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.