码迷,mamicode.com
首页 > 数据库 > 详细

CentOS源码编译安装MySQL 5.5.15

时间:2014-09-07 20:58:55      阅读:369      评论:0      收藏:0      [点我收藏+]

标签:http   os   io   ar   文件   art   div   sp   log   

CentOS源码编译安装MySQL 5.5.15

 

安装编译工具

  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]

CentOS源码编译安装MySQL 5.5.15

标签:http   os   io   ar   文件   art   div   sp   log   

原文地址:http://www.cnblogs.com/L-H-R-X-hehe/p/3960778.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!