Linux下mysql多版本共存安装_MySQL多版本安装在同一linux主机上

我的环境:

我的主机是CentOS5.2,已经安装了默认自带的mysql5045,现在想安装最新的5129和607来做测试

安装注意事项:

配置时的路径如下填写

./configure --with-tcp-port=5506 --with-unix-socket-path=/opt/MySQL5129 --prefix=/opt/MySQL5129

./configure --with-tcp-port=5507 --with-unix--socket-path=/opt/MySQL607 --prefix=/opt/MySQL607

--with-unix-socket-path这个参数可以不要,最后在my.cnf里面指定socket文件存放在什么路径

make

make install

这两步就没有什么好说的了

安装后的配置:

初始化数据库权限表

./mysql_install_db --basedir=/opt/MySQL5129 --datadir=/opt/MySQL5129/var --user=mysql

./mysql_install_db --basedir=/opt/MySQL607 --datadir=/opt/MySQL607/var --user=mysql

配置/etc/my.cnf参数文件:

[mysqld5129]

port=5506

socket=/tmp/mysql5129.sock

basedir=/opt/MySQL5129

datadir=/opt/MySQL5129/var

user=mysql

log-error=/var/log/mysqld5129.log

pid-file=/tmp/mysqld5129.pid

[mysqld607]

port=5507

socket=/tmp/mysql607.sock

basedir=/opt/MySQL607

datadir=/opt/MySQL607/var

user=mysql

log-error=/var/log/mysqld607.log

pid-file=/tmp/mysqld607.pid

启动数据库:

/opt/MySQL5129/bin/mysqld_multi start|stop  5129

/opt/MySQL607/bin/mysqld_multi start|stop  607

连接数据库:

mysql --socket=/tmp/mysql5129.sock

mysql --socket=/tmp/mysql607.sock

CU的yejr也推荐用mysqlmanager来管理mysql

有时间安装mysqlmanager来看看

常见的编译参数:

--without-debug

--with-low-memory

--with-charset=cp1251(gbk,gb2312,utf8)

--with-collation=cp1251_general_ci(gbk,gb2312,utf8)

--with-extra-charset=all

--with-plugins

--with-mysqld-ldflags=-all-static

mysqlperformanceblog在Freebsd平台上编译客户端的一个示例

./configure

'--localstatedir=/var/db/mysql'

'--without-debug'

'--without-readline'

'--without-libedit'

'--without-bench'

'--without-extra-tools'

'--with-libwrap'

'--with-mysqlfs'

'--with-low-memory'

'--with-comment=FreeBSD port: mysql-client-5.0.67_1'

'--enable-thread-safe-client'

'--with-charset=cp1251'

'--with-collation=cp1251_general_ci'

'--with-extra-charset=all'

'--with-named-thread-libs=-pthread'

'--without-server'

'--prefix=/usr/local'

'--mandir=/usr/local/man'

'--infodir=/usr/local/info/'

'--build=amd64-portbld-freebsd7.0'

'CC=cc' 'CFLAGS=-O2 -mmmx -msse -msse2 -msse3 -pipe -march=nocona  -fno-strict-aliasing'

'CXXFLAGS=-O2 -mmmx -msse -msse2 -msse3 -pipe -march=nocona -fno-strict-aliasing -O2 -mmmx -msse -msse2 -msse3 -pipe -march=nocona  -fno-strict-aliasing -felide-constructors -fno-rtti -fno-exceptions'

'CXX=c++'

'build_alias=amd64-portbld-freebsd7.0'

linux平台下的一个示例

./configure --prefix=/usr/local/mysql

--with-charset=utf8

--with-collation=utf8_general_ci

--with-client-ldflags=-all-static

--with-mysqld-ldflags=-all-static

--enable-assembler

--enable-thread-safe-client

–without-debug

--enable-local-infile

--with-big-tables

--with-ssl

--without-readline

--with-plugins=innodb,partition

--with-fast-mutexes

--with-zlib-dir=bundled

--with-××ded-server

--with-pthread

CFLAGS="-O3" CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"

./configure

--prefix=/usr/local/mysql

--localstatedir=/data/mysql/data

--enable-assembler

--with-charset=utf8

--with-client-ldflags=-all-static

--with-mysqld-ldflags=-all-static

--with-innodb

--with-plugins=partition

mysql编译参数详解

./configure \

--prefix=/usr/local/mysql \

--enable-assembler \

--without-debug \

--with-charset=utf8 \

--with-extra-charsets=all \

--with-pthread \

--enable-thread-safe-client \

--enable-local-infile \

--with-client-ldflags=-all-static \

--with-mysqld-ldflags=-all-static \

--with-big-tables \

--without-innod \

--without-isam 2;

--with-ssl \

--with-embedded-server \

--enable-assembler \使用一些字符函数的汇编版本

--without-debug \去除debug模式

--with-charset=utf8 \

--with-extra-charsets=complex字符支持

--with-pthread \强制使用pthread库(posix线程库)

--enable-thread-safe-client \以线程方式编译客户端

--with-client-ldflags=-all-static \以纯静态方式编译客户端

--with-mysqld-ldflags=-all-static \以纯静态方式编译服务端

--with-big-tables

There is a limit of 232 (~4.295E+09) rows in a MyISAM table. If you build MySQL with the --with-big-tables option, the row limitation is increased to (232)2 (1.844E+19) rows

--without-innodb \去掉innodb表支持,innodb是一种支持事务处理的表,适合企业级应用

--enable-local-infile #让mysql支持从本地文件 导入数据库

--without-isam \去掉isam表类型支持,现在很少用了,isam表是一种依赖平台的表

--with-embedded-server #编译成embedded MySQL library (libmysqld.a)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值