Linux下源码编译安装Mysql5.1及支持多个Mysql实例
来源:互联网 发布:如何用excel做数据统计 编辑:程序博客网 时间:2024/04/29 17:24
Linux下源码编译安装Mysql5.1及支持多个Mysql实例
一、安装单实例Mysql5.1服务器
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql --with-charset=utf8 --without-debug --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --disable-shared --with-mysqld-user=mysql --with-extra-charsets=gb2312,big5,gbk
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 2345 mysqld on
PATH=/usr/local/mysql/bin:$PATH
echo "PATH=/usr/local/mysql/bin:/$PATH" >> /etc/profile
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
二、多实例安装Mysql5.1服务器
一、安装监听端口3306的Mysql服务器
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql3306 --with-unix-socket-path=/usr/local/mysql3306/var/mysql.sock --sysconfdir=/usr/local/mysql3306/etc --with-charset=utf8 --without-debug --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --disable-shared --with-mysqld-user=mysql --with-extra-charsets=gb2312,big5,gbk
shell> make
shell> make install
shell> mkdir /usr/local/mysql3306/etc
shell> cp support-files/my-medium.cnf /usr/local/mysql3306/etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld3306
chmod 755 /etc/init.d/mysqld3306
chkconfig --add mysqld3306
chkconfig --level 2345 mysqld3306 on
PATH=/usr/local/mysql3306/bin:$PATH
echo "PATH=/usr/local/mysql3306/bin:/$PATH" >> /etc/profile
shell> cd /usr/local/mysql3306
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
修改my.cnf设置监听端口为3306
二、安装监听端口3307的Mysql服务器
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql3307 --with-unix-socket-path=/usr/local/mysql3307/var/mysql.sock --sysconfdir=/usr/local/mysql3307/etc --with-charset=utf8 --without-debug --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --disable-shared --with-mysqld-user=mysql --with-extra-charsets=gb2312,big5,gbk
shell> make
shell> make install
shell> mkdir /usr/local/mysql3307/etc
shell> cp support-files/my-medium.cnf /usr/local/mysql3307/etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysql3307
chmod 755 /etc/init.d/mysql3307
chkconfig --add mysql3307
chkconfig --level 2345 mysql3307 on
PATH=/usr/local/mysql3306/bin:$PATH
echo "PATH=/usr/local/mysql3306/bin:/$PATH" >> /etc/profile
shell> cd /usr/local/mysql3307
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
修改my.cnf设置监听端口为3307
三、编译参数解析
编译参数解析
--prefix=/usr/local/mysql3306 指定安装路径
--with-unix-socket-path=/usr/local/mysql3306/var/mysql.sock 指定socket的套接字文件,多个实例时必须指定,否则多个实例会同时默认取/tmp/mysql.sock
--sysconfdir=/usr/local/mysql3306/etc mysql实例启动后的配置文件所在,默认是安装路径下的[PREFIX/etc]此处指定的目的是强调需为每个实例配置my.cnf,同时需要保证 /etc/my.cnf不存在,因为启动脚本一般会先去读/etc/my.cnf
--with-charset=utf8 默认字符集
--with-extra-charsets=gb2312,big5,gbk 支持的其他字符集,减少不必要的开销,Mysql默认支持20多种字符集
--without-debug 去掉调试模式,据说可以优化
--enable-assembler 使用一些字符函数的汇编版本,据说可以优化性能
--with-client-ldflags=-all-static 以纯静态方式编译客户端,如果服务器实例上不需要客户端,这项可以不要,不过建议还是留着,登录到数据库服务器上,直接mysql已经是默认习惯了。
--with-mysqld-ldflags=-all-static 以纯静态方式编译服务端,据说对性能优化很有用
--disable-shared 不提供动态链接库
--with-mysqld-user=mysql 启动用户设置为mysql
- Linux下源码编译安装Mysql5.1及支持多个Mysql实例
- Linux环境下源码编译安装MySQL5.1
- Linux环境下源码编译安装MySQL5.5
- Linux下编译安装MySQL5.1
- linux中源码安装mysql,并启动多个实例
- linux中源码安装mysql,并启动多个实例
- 开发人员学Linux(6):CentOS7编译安装MySQL5.17.8多实例及主从复制
- Linux系统下MySQL源码安装,完整编译支持所有字符集和默认字符集
- Linux下源码编译安装Mysql
- Windows下 安装Mysql5.7.16多个实例
- mysql安装 linux源码安装mysql5.6.22
- centos编译安装mysql 5.6及安装多个mysql实例
- Linux下安装mysql数据库(源码编译安装)及排错
- Linux下Mysql源码安装及使用
- Centos7.1 for MySQL5.6.30源码安装及多实例配置
- CentOS 上 编译MySQL-5.7.x 或者 MySQL-8.0 源码 及多实例安装
- MySQL安装-源码方式-linux下cmake源码安装mysql5.5.27
- linux 系统源码安装 mysql 、fedora10 mysql5
- 最近一段时间荒废了博客
- 快期末考试了~
- 使用MySQL计划任务
- linux一些个非官方网站
- NS跨层设计之AODV访问ifq(三)
- Linux下源码编译安装Mysql5.1及支持多个Mysql实例
- 决定来csdn安家了
- MPEG中的三种图像类型(I帧、P帧、B帧)及码流组成
- Android系列教程之七:EditText使用详解-包含很多教程上看不到的功能演示
- aspx后台实现Excel导入到SqlServer中
- 自写试衣间时的疑问
- 《JavaScript语言精粹》读书笔记
- SBR技术的实现原理
- SQL SERVER 同表跨连接拷贝数据