一、准备工作
1、关闭mysql进程
# pkill
# service mysqld stop

2、从系统服务中删除mysqld
# chkconfig --del mysqld

3、删除mysqld
# rm -rf /etc/init.d/mysqld

4、创建各个实例的目录
# mkdir /data/{3306/data,3307/data} -pv

5、修改实例目的权限
# chown -R mysql.mysql /data/

二、准备mysql的配置文件
1、复制模板生成配置文件
# cp /root/mysql-5.5.19/support-files/my-large.cnf /data/3306/my.cnf
# cp /root/mysql-5.5.19/support-files/my-large.cnf /data/3307/my.cnf

2、编辑两个实例的配置文件
[client]
port = 3307
socket = /data/3307/mysql.sock

[mysqld]
user = mysql
port = 3307
socket = /data/3307/mysql.sock
basedir = /usr/local/mysql
datadir = /data/3307/data

server-id = 7

[mysqld_safe]
log-error = /data/3307/err_3307.log
pid-file = /data/3307/mysqld.pid

3、初始化mysql实例
# /root/mysql-5.5.19/scripts/mysql_install_db --user=mysql --datadir=/data/3307/data/ --basedir=/usr/local/mysql/
# /root/mysql-5.5.19/scripts/mysql_install_db --user=mysql --datadir=/data/3306/data/ --basedir=/usr/local/mysql/

4、启动各个实例
# /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/3306/my.cnf &
# /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/3307/my.cnf &

5、登录mysql
# /usr/local/mysql/bin/mysql -u root -p -S /data/3306/mysql.sock
# /usr/local/mysql/bin/mysql -u root -p -S /data/3307/mysql.sock