Centos 安装多个mysql方法

建用户与组

groupadd mysql

useradd -g mysql mysql

 

解压mysql安装包

#tar zxf mysql-5.5.3-m3.tar.gz

#cd mysql-5.5.3-m3

#./configure

–prefix=/usr/local/mysql3308

–sysconfdir=/usr/local/mysql3308/etc

–with-tcp-port=3308

–localstatedir=/usr/local/mysql3308/localstate –with-unix-socket-path=/tmp/mysql3308.sock

–with-extra-charsets=all

–enable-thread-safe-client

–with-plugins=innobase

–with-mysqld-user=mysql

–with-client-ldflags=-all-static

–with-mysqld-ldflags=-all-static

#make

#make install

 

初始化db

#/usr/local/mysql3308/bin/mysql_install_db 

–user=mysql

–datadir=/usr/local/mysql3308/localstate/

创建etc文件夹

#mkdir /usr/local/mysql3308/etc

复制my.cnf

#cp support-files/my-medium.cnf /usr/local/mysql3308/etc/my.cnf

 

修改my.cnf

Centos 安装多个mysql方法

复制mysql.server至/etc/rc.d/init.d

#cp support-files/mysql.server /etc/rc.d/init.d/mysql3308

修改权限

#chmod +x /etc/rc.d/init.d/mysql3308

修改mysql3308

Centos 安装多个mysql方法

修改目录权限

 

#chown -R root:mysql /usr/local/mysql3308/

#chown -R mysql:mysql /usr/local/mysql3308/localstate/

启动与停止

#/etc/rc.d/init.d/mysql3308 start

#/etc/rc.d/init.d/mysql3308 stop

查看一下

#netstat -ltanp | grep mysql

Centos 安装多个mysql方法

登陆一下

Centos 安装多个mysql方法

 

依此方法便可创建多个mysql