mysql单实例_mysql单实例安装

系统环境:centos 6.2 64位

内核版本: 2.6.32-220.el6.x86_64

mysql版本:5.1.62

1、1首先创建mysql用户和组:

[root@cqb ~]# groupadd mysql

[root@cqb ~]# useradd -s /sbin/nologin -g mysql -M mysql

1、2下载mysql源码包后解压安装。

[root@cqb ~]# wget http://mysql.ntu.edu.tw/Downloads/MySQL-5.1/mysql-5.1.62.tar.gz

[root@cqb ~]# tar zxvf mysql-5.1.62.tar.gz

[root@cqb ~]# cd mysql-5.1.62

trans.gif

[root@cqb mysql-5.1.62]# ./configure --prefix=/usr/local/mysql --enable-assembler --enable-thread-safe-client --with-mysqld-user=mysql --with-big-tables --without-debug --with-pthread --with-extra-charsets=complex --with-readine --with-ssl --with-embedded-server --enable-local-infole --with-plugin=partition,innobase --with-plugin-PLUGIN --with-mysqld-ldflags=-all-static --with-client-ldfags=-all-static

[root@cqb mysql-5.1.62]# make && make install

1、3 mysql参数说明:

--prefix=/usr/local/mysql   #指定mysql的安装路径

--enable-assembler  #允许使用汇编模式(优化性能)

--enable-thread-safe-client  #以线程方式编译mysql

--with-mysqld-user=mysql  #指定mysql运行的系统的用户

--with-big-tables #支持大表,即使是32位的系统也能支持4G以上的表

--without-debug  #使用非debug模式

--with-pthread   #强制使用pthread线程库编译

--with-extra-charsets=complex   #mysql默认的字符集使用complex

--with-ssl    #支持ssl

--with-plugin=partition,innobase

--with-plugin-PLUGIN

--with-mysqld-ldflags=-all-static   #服务器使用静态库(优化性能)

--with-client-ldfags=-all-static    #客户端使用静态库(优化性能)

更多参数请看源码目录的INSTALL或者./configure --help

1、4获得mysql配置文件和安装mysql数据库文件

[root@cqb mysql-5.1.62]# ll support-files/*.cnf

-rw-r--r--. 1 root root  4680  9月 24 03:03 support-files/my-huge.cnf

-rw-r--r--. 1 root root 19731  9月 24 03:03 support-files/my-innodb-heavy-4G.cnf

-rw-r--r--. 1 root root  4654  9月 24 03:03 support-files/my-large.cnf

-rw-r--r--. 1 root root  4665  9月 24 03:03 support-files/my-medium.cnf

-rw-r--r--. 1 root root  2433  9月 24 03:03 support-files/my-small.cnf

以上都是mysql在各个环境的配置文件,由于是安装实验环境这里就使用my-small.cnf配置文件

[root@cqb mysql-5.1.62]# /bin/cp support-files/my-small.cnf /etc/my.cnf

#注:使用cp命令的全路径/usr/bin 不提示覆盖,如果/etc目录下有my.cnf文件会直接覆盖

[root@cqb mysql-5.1.62]# mkdir /usr/local/mysql/data

#创建mysql数据库文件

[root@cqb mysql-5.1.62]# /usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data

安装mysql数据库文件

1、5启动mysql

[root@cqb mysql-5.1.62]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld

#复制mysql启动脚本到/etc/rc.d/init.d/

[root@cqb mysql-5.1.62]# chmod 755 /etc/rc.d/init.d/mysqld

#让mysql启动脚本可执行

[root@cqb mysql-5.1.62]# service mysqld start

正在启动 mysqld:                                          [确定]

#启动mysql。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值