mysql5.1.70源码安装详细步骤,支持openssl,支持innodb_plugin存储引擎
一.首先编译安装openssl
1.首先需要创建mysql用户
shell>groupadd mysql
shell>useradd -s /sbin/nologin -g mysql mysql
#设置mysql默认bash为nologin,不允许登录系统
2.依赖关系
shell>yum install ncurses
shell>yum install ncurses-devel
shell>yum install gcc libgcc gcc-c++ compat-gcc
shell>yum install libtool libtool-ltdl-devel
3.编译安装openssl
shell>wget http://www.openssl.org/source/openssl-1.0.1f.tar.gz
shell>tar -zxvf openssl-1.0.1f.tar.gz
shell>cd openssl-1.0.1f
shell>./config -fPIC#不添加-fPIC参数,在make mysql阶段会报错
shell>make && make install
#openssl默认安装位置在/usr/local/ssl
在编译openssl时
##error1
../include/violite.h:98:30: 错误:openssl/opensslv.h:没有那个文件或目录
../include/violite.h:114:25: 错误:openssl/ssl.h:没有那个文件或目录
../include/violite.h:115:25: 错误:openssl/err.h:没有那个文件或目录
In file included from libmysql.c:30:
../include/violite.h:127: 错误:expected specifier-qualifier-list before ‘SSL_CTX’
make[2]: *** [libmysql.lo] 错误 1
make[2]: Leaving directory `/root/nginx/mysql-5.5.3-m3/libmysql‘
make[1]: *** [all] 错误 2
make[1]: Leaving directory `/root/nginx/mysql-5.5.3-m3/libmysql‘
make: *** [all-recursive] 错误 1
解决:
shell>yum install openssl*
##error2
/usr/local/ssl/lib/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [openssl.so] Error 1
解决:
#重新编译openssl,加上-fPIC参数
shell>.config -fPIC
二../configure配置参数
#加载openssl路径 shell>LDFLAGS="-L/usr/local/ssl/lib" CFLAGS="-I/usr/local/ssl/include" CPPFLAGS="-I/usr/local/ssl/include" CXXFLAGS="-I/usr/local/ssl/include" #centos上测试不带这条也可以 #配置 shell>./configure --prefix=/usr/local/mysql --datadir=/data/mysql --with-charset=utf8 --with-extra-charsets=complex --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock --with-pthread --with-ssl=/usr/local/ssl --enable-assembler --with-plugins=partition,archive,csv,federated,heap,innobase,myisam,myisammrg --with-mysqld-user=mysql
配置各项解释:
--prefix=/usr/local/mysql #基本安装目录 --datadir=/data/mysql #数据文件安装目录 --with-tcp-port=3306 #mysqld服务默认监听端口为3306,可以在这里指定一个端口 --with-charset=utf8 --with-extra-charsets=complex #字符编码设置 --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock #mysql.sock用于服务器和客户机之间的通信,默认位置在/tmp/mysql.sock --with-pthread --with-ssl=/usr/local/ssl #选择前一步骤中openssl的安装路径 --enable-assembler #To build the embedded MySQL library (libmysqld.a), use the #--with-embedded-server option --with-plugins=partition,archive,csv,federated,heap,innobase,myisam,myisammrg --with-mysqld-user=mysql
三.编译安装
shell>make %% make install
四.安装后配置
1.更改权限
shell>chown mysql.mysql /usr/local/mysql -R
shell>chown mysql.mysql /data/mysql -R
2.复制配置文件
shell>cd /home/mysql-5.1.70
shell>cp mysql-5.1.70/support-files/my-large.cnf /etc/my.cnf
##添加datadir
shell>vim /etc/my.cnf
datadir=/data/mysql
3.复制mysqld启动脚本
shell>cp mysql-5.1.70/support-files/mysql.server /etc/init.d/mysqld
shell>chmod 755 /etc/init.d/mysqld
4.初始化数据库
shell>/usr/local/mysql/bin/mysql_install_db --user=mysql
5.登录
shell>/usr/local/mysql/bin/mysql -uroot -p
6.修改密码
shell>/usr/local/mysql/bin/mysqladmin -u root password ‘mysql‘
7.添加ssl支持
shell>/etc/init.d/mysqld stop
shell>vim /etc/my.cnf
ssl
mysql> show variables like ‘%ssl%‘;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_openssl | YES |
| have_ssl | YES |
| ssl_ca | |
| ssl_capath | |
| ssl_cert | |
| ssl_cipher | |
| ssl_key | |
+---------------+-------+
8.安装innodb_plugin 支持
innodb_plugin 已经被内置在mysql安装目录下的/lib/mysql/plugin/中
shell>/etc/init.d/mysqld stop
shell>vim /etc/my.cnf
添加
ignore_builtin_innodb plugin-load=innodb=ha_innodb_plugin.so;innodb_trx=ha_innodb_plugin.so;innodb_locks=ha_innodb_plugin.so;innodb_lock_waits=ha_innodb_plugin.so;innodb_cmp=ha_innodb_plugin.so;innodb_cmp_reset=ha_innodb_plugin.so;innodb_cmpmem=ha_innodb_plugin.so;innodb_cmpmem_reset=ha_innodb_plugin.so
重启mysqld
shell>/etc/init.d/mysqld restart
shell>/usr/local/mysql/bin/mysql -uroot -p
mysql> show plugins;
本文出自 “fightering-cluter” 博客,请务必保留此出处http://3974020.blog.51cto.com/3964020/1398183
mysql5.1.70源码安装详细步骤,支持openssl,支持innodb_plugin存储引擎,古老的榕树,5-wow.com
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。