以前使用源代码安装过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
- groupadd mysql
-
useradd -r -g mysql mysql
-
tar -zxvf mysql-5.6.2-m5.tar.gz
-
cd mysql-5.6.2-m5
-
/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
-
make
-
make install
- cd /usr/local/mysql
- chown -R mysql .
- chgrp -R mysql .
- scripts/mysql_install_db --user=mysql
- chown -R root .
- chown -R mysql data
- cp support-files/my-medium.cnf /etc/my.cnf
- bin/mysqld_safe --user=mysql &
- [root@Snort-test local]# mysql -uroot -p
- Enter password:
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 1
- Server version: 5.6.2-m5-log Source distribution
- Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
- mysql> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | mysql |
- | performance_schema |
- | test |
- +--------------------+
- 4 rows in set (0.00 sec)
- mysql>
- #完成安装
2.3开发包的源代码安装
阅读(1618) | 评论(0) | 转发(0) |