CentOS源碼編譯安裝MySQL 5.5.15)

來源:互聯網
上載者:User
安裝編譯工具
  1. yum install gcc gcc-c++
  2. yum install ncurses-devel
下載源碼
  1. mkdir -p /tmp
  2. cd /tmp
  3. wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.15.tar.gz/from/http://mysql.he.net/
  4. wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
  5. wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
安裝cmake和bison
  1. cd /tmp
  2. tar zxvf cmake-2.8.4.tar.gz
  3. cd cmake-2.8.4
  4. ./bootstrap
  5. make
  6. make install
  1. cd /tmp
  2. tar zxvf bison-2.5.tar.gz
  3. cd bison-2.5
  4. ./configure
  5. make
  6. make install
編譯安裝MySQL
  1. /usr/sbin/groupadd mysql
  2. /usr/sbin/useradd -g mysql mysql
  3. cd /tmp
  4. tar xvf mysql-5.5.15.tar.gz
  5. cd mysql-5.5.15/
  6. cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
  7. -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
  8. -DDEFAULT_CHARSET=utf8 \
  9. -DDEFAULT_COLLATION=utf8_general_ci \
  10. -DWITH_EXTRA_CHARSETS=all \
  11. -DWITH_MYISAM_STORAGE_ENGINE=1 \
  12. -DWITH_INNOBASE_STORAGE_ENGINE=1 \
  13. -DWITH_MEMORY_STORAGE_ENGINE=1 \
  14. -DWITH_READLINE=1 \
  15. -DENABLED_LOCAL_INFILE=1 \
  16. -DMYSQL_DATADIR=/var/mysql/data \
  17. -DMYSQL_USER=mysql
  18.  
  19. make
  20. make install

詳細編譯參數參考:http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html

一些相關設定
  1. chmod +w /usr/local/mysql
  2. chown -R mysql:mysql /usr/local/mysql
  3. ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
  4. mkdir -p /var/mysql/
  5. mkdir -p /var/mysql/data/
  6. mkdir -p /var/mysql/log/
  7. chown -R mysql:mysql /var/mysql/
  8. cd support-files/
  9. cp my-large.cnf /var/mysql/my.cnf
  10. cp mysql.server /etc/rc.d/init.d/mysqld
  11.  
  12. /usr/local/mysql/scripts/mysql_install_db \
  13. --defaults-file=/var/mysql/my.cnf \
  14. --basedir=/usr/local/mysql \
  15. --datadir=/var/mysql/data \
  16. --user=mysql
  17.  
  18. chmod +x /etc/init.d/mysqld
  1. vi /etc/init.d/mysqld(編輯此檔案,尋找並修改以下變數內容:)
  2. basedir=/usr/local/mysql
  3. datadir=/var/mysql/data

加入啟動項:

  1. chkconfig --add mysqld
  2. chkconfig --level 345 mysqld on

啟動服務:

  1. service mysqld start

設定密碼:

  1. /usr/local/mysql/bin/mysqladmin password [new-password]
相關文章

聯繫我們

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