Chinaunix首页 | 论坛 | 博客
  • 博客访问: 193911
  • 博文数量: 53
  • 博客积分: 2059
  • 博客等级: 大尉
  • 技术积分: 577
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-30 03:03
文章分类
文章存档

2012年(4)

2011年(19)

2010年(30)

分类: Mysql/postgreSQL

2011-05-06 14:03:45

以前使用源代码安装过5.1Mysql,后来由于生产环境一直用RPM包安装,所以渐渐的忽略了源代码安装,由于最近比较空闲,所以在网上搜索了一些相关的内容,自己试验一下。
从新的文档文档上来看Mysql改变了编译的方式,采用Cmake来编译,在说明文档里面有一些介绍,并且说明了从源代码安装Mysql的两种源代码方式,一个是标准的源代码另外一个是开发版的源代码安装。
 There are two methods for installing MySQL from source:

     * Use a standard MySQL source distribution. To obtain a standard
       distribution, see Section 2.1.3, "How to Get MySQL." For
       instructions on building from a standard distribution, see
       Section 2.9.2, "Installing MySQL from a Standard Source
       Distribution."
       Standard distributions are available as compressed tar files,
       Zip archives, or RPM packages. Distribution files have names
       of the form mysql-VERSION.tar.gz, mysql-VERSION.zip, or
       mysql-VERSION.rpm, where VERSION is a number like 5.6.3. File
       names for source distributions can be distinguished from those
       for precompiled binary distributions in that source
       distribution names are generic and include no platform name,
       whereas binary distribution names include a platform name
       indicating the type of system for which the distribution is
       intended (for example, pc-linux-i686 or winx64).

     * Use a MySQL development tree. Development trees have not
       necessarily received the same level of testing as standard
       release distributions, so this installation method is usually
       required only if you need the most recent code changes. For
       information on building from one of the development trees, see
       Section 2.9.3, "Installing MySQL from a Development Source
       Tree."
这两种安装方式都是需要以下软件支持:
libncurses
bison
cmake
libaio
perl
tar 等
2.源代码安装Mysql
2.1标准源代码安装Mysql
2.1.1安装前准备工作
安装libncurses
tar xzf ncurses-5.7.tar.gz cd ncurses-5.7 ./configure --prefix=/usr/ncurses make make install
安装bison
首先确认m4安装位置,把它的位置放到变量中/etc/profile 
PATH=$PATH:/usr/bin/m4  (一般m4的位置在/usr/bin/m4 下面不需要额外设置)
tar -xvzf bison-2.3.tar.gz cd bison-2.3 ./configure --prefix=/usr/local/bison --with-libiconv-prefix=/usr/local/lib make make install
安装cmake
地址为 是一个开源的编译软件
tar xzf cmake-2.8.4.tar.gz cd cmake-2.8.4 ./configure --prefix=/usr/cmake make make instal
安装libaio 其实只需要解压即可
cd /usr wget ~wkj/download/libaio.tbz bunzip2 libaio.tbz tar xf libaio.tar
2.2安装Mysql5.6
  1. groupadd mysql
  2. useradd -r -g mysql mysql
  3. tar -zxvf mysql-5.6.2-m5.tar.gz
  4. cd mysql-5.6.2-m5
  5. /usr/cmake/bin/cmake . -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/usr/local/mysql/data/ -DCMAKE_INSTALL_PREFIX=/usr/local/mysqlDCURSES_LIBRARY=/usr/ncurses/lib/libncurses.a -DCURSES_INCLUDE_PATH=/usr/ncurses/include/ -DHAVE_LIBAIO_H=/usr/libaio/include/ -DINSTALL_LAYOUT=STANDALONE -DENABLED_PROFILING=ON -DMYSQL_MAINTAINER_MODE=OFF -DWITH_DEBUG=OFF
  6. make
  7. make install
  8. cd /usr/local/mysql
  9. chown -R mysql .
  10. chgrp -R mysql .
  11. scripts/mysql_install_db --user=mysql
  12. chown -R root .
  13. chown -R mysql data
  14. cp support-files/my-medium.cnf /etc/my.cnf
  15. bin/mysqld_safe --user=mysql &
  16. [root@Snort-test local]# mysql -uroot -p
  17. Enter password: 
  18. Welcome to the MySQL monitor.  Commands end with ; or \g.
  19. Your MySQL connection id is 1
  20. Server version: 5.6.2-m5-log Source distribution

  21. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

  22. mysql> show databases;
  23. +--------------------+
  24. | Database           |
  25. +--------------------+
  26. | information_schema | 
  27. | mysql              | 
  28. | performance_schema | 
  29. | test               | 
  30. +--------------------+
  31. 4 rows in set (0.00 sec)

  32. mysql> 
  33. #完成安装


2.3开发包的源代码安装




阅读(1468) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~