centos6.8编译安装mysql

Posted alonesea

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6.8编译安装mysql相关的知识,希望对你有一定的参考价值。

1.首先下载mysql的源码包

wget http://down1.chinaunix.net/distfiles/mysql-5.5.20.tar.gz

2.安装需要的编译工具

yum install cmake make ncurses-devel ncurses gcc gcc-c++ -y

3.解压源码包

tar -zxvf mysql-5.5.20.tar.gz
cd mysql-5.5.20

4.开始编译安装

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql56/
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock
-DMYSQL_DATADIR=/data/mysql/
-DSYSCONFDIR=/etc
-DMYSQL_USER=mysql
-DMYSQL_TCP_PORT=3306
-DWITH_XTRADB_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_MYISAM_STORAGE_ENGINE=1
-DWITH_READLINE=1
-DENABLED_LOCAL_INFILE=1
-DWITH_EXTRA_CHARSETS=1
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all
-DWITH_BIG_TABLES=1
-DWITH_DEBUG=0`

make
make install

5.设置开机启动和配置文件

cd /usr/local/mysql56/
cp support-files/my-large.cnf/ etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chkconfig –add mysqld
chkconfig –level 35 mysqld on
mkdir -p /data/mysql
useradd mysql

6.初始化

/etc/init.d/mysqld/usr/local/mysql56/scripts/mysql_install_db –user=mysql –datadir=/data/mysql/ –basedir=/usr/local/mysql56/
ln -s /usr/local/mysql55/bin/* /usr/bin/

ok,到此mysql就编译安装完成,可用命令ps -ef |grep mysql查看mysql是否启动。




























以上是关于centos6.8编译安装mysql的主要内容,如果未能解决你的问题,请参考以下文章

CentOS6.8手动安装MySQL5.6

CentOS6.8手动安装MySQL5.6

CentOS6.8手动安装MySQL5.6

CentOS6.8下安装MySQL5.6

Centos6.8源码编译安装zabbix3.4.1

CentOS6.8 x86_64bit mysql-5.5.57多实例安装