CentOS系统下编译安装MySQL以及设置相关yum源的教程
编译安装软件通常会遇到各种问题,尤其是在编译lamp这样的多种软件协同工作时各软件还相互影响,尤其是之前安装的软件会影响后边程序的编译安装,出现这种问题常常是之前安装的软件没有导出库文件和头文件,因而导致后面的软件在安装是需要指定前面安装程序的路径时常常提示找不到文件之类的错误,下面以mysql为例
1、安装开发环境
yum groupinstall "development tools"
2、解决软件包依赖包
安装编译代码需要的包
yum -y install make gcc-c++ cmake bison-devel ncurses-devel
下载mysql 5.6.14
wget http://cdn.mysql.com/downloads/mysql-5.6/mysql-5.6.14.tar.gz tar xvf mysql-5.6.14.tar.gz cd mysql-5.6.14
3、配置编译并安装
cmake \ -dcmake_install_prefix=/usr/local/mysql \ -dmysql_datadir=/usr/local/mysql/data \ -dsysconfdir=/etc \ -dwith_myisam_storage_engine=1 \ -dwith_innobase_storage_engine=1 \ -dwith_memory_storage_engine=1 \ -dwith_readline=1 \ -dmysql_unix_addr=/var/lib/mysql/mysql.sock \ -dmysql_tcp_port=3306 \ -denabled_local_infile=1 \ -dwith_partition_storage_engine=1 \ -dextra_charsets=all \ -ddefault_charset=utf8 \ -ddefault_collation=utf8_general_ci make && make install
4、导出库搜索
在 /etc/ld.conf.d/mysql.conf 目录下创建相应的conf文件
ldconfig -v | grep mysql
5、导出头文件
ln -sv /usr/local/mysql/include /usr/include/mysql
6、导出帮助文件
vim /etc/man.config manpath /usr/local/mysql/man
7、导出二进制路径
vim /etc/profile path=/usr/local/mysql/bin:$path source /etc/profile
ps:如何使用mysql yum源来安装更新mysql相关软件包
mysql yum库提供了一个简单的和方便的方法来安装和更新mysql相关的软件包到最新版本。
mysql yum库文档说明:http://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
mysql yum库支持的平台有:
red hat enterprise linux 7 / oracle linux 7
red hat enterprise linux 6 / oracle linux 6
red hat enterprise linux 5 / oracle linux 5
fedora 18, 19, and 20
mysql yum库包括最新的软件包有:
- mysql 5.6 (ga)
- mysql 5.7 (development release)
- mysql 5.5 (ga - red hat enterprise linux and oracle linux only)
- mysql workbench
- mysql fabric
- mysql utilities
- mysql connector / odbc
- mysql connector / python
rhel7/centos7/oracle linux7:
# rpm -uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm # rpm -uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
rhel5/centos5/oracle linux5:
# rpm -uvh http://dev.mysql.com/get/mysql-community-release-el5-5.noarch.rpm
fedora
# fedora20
# rpm -uvh http://dev.mysql.com/get/mysql-community-release-fc20-5.noarch.rpm
#fedora19
# rpm -uvh http://dev.mysql.com/get/mysql-community-release-fc19-5.noarch.rpm
# fedora18
# rpm -uvh http://dev.mysql.com/get/mysql-community-release-fc18-5.noarch.rpm
上一篇: 关于Java中反射机制的深入讲解
下一篇: Java把数字格式化为货币字符串实例代码