您的位置:首页 > 数据库 > MySQL

同一台做事器装置两个mysql(不同端口)

2011-03-07 14:13 155 查看
作者: Dailon 出自: http://www.linuxdiyf.com
mysql1:应用默许设置装备安排

root@localhost usr]# groupadd mysql
[root@localhost usr]# useradd -g mysql mysql
[root@localhost usr]# cd /usr/local
[root@localhost local]# tar -zxvf mysql-5.0.51.tar.gz
[root@localhost local]# cd mysql-5.0.51
[root@localhost mysql-5.0.51# ./configure --prefix=/usr/local/mysql
[root@localhost mysql-5.0.51]# make
[root@localhost mysql-5.0.51]# make install
[root@localhost mysql-5.0.51]# cd ../mysql
[root@localhost mysql]# scripts/mysql_install_db --user=mysql
[root@localhost mysql]# chown -R root .
[root@localhost mysql]# chown -R mysql var
[root@localhost mysql]# chgrp -R mysql .
[root@localhost mysql]# ./bin/mysqld_safe --user=mysql &
[root@localhost mysql]# ./bin/mysqladmin -uroot password mysql
[root@localhost mysql]# cp ../mysql-5.0.51/support-files/my-large.cnf /etc/my.cnf
[root@localhost mysql]# cp ../mysql-5.0.51/support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@localhost mysql]# chkconfig --add mysqld
[root@localhost mysql]# chkconfig --level mysqld 345 on
[root@localhost mysql]# chkconfig --list mysqld
[root@localhost mysql]#

mysql2应用3307端口,设置装备安排文件为:/etc/my5.cnf

root@localhost usr]# groupadd mysql
[root@localhost usr]# useradd -g mysql mysql
[root@localhost usr]# cd /usr/local
[root@localhost local]# tar -zxvf mysql-5.0.51.tar.gz
[root@localhost local]# cd mysql-5.0.51
[root@localhost mysql-5.0.51# ./configure --prefix=/usr/local/mysql5
[root@localhost mysql-5.0.51]# make
[root@localhost mysql-5.0.51]# make install
[root@localhost mysql-5.0.51]# cd ../mysql
[root@localhost mysql]# scripts/mysql_install_db --user=mysql
[root@localhost mysql]# chown -R root .
[root@localhost mysql]# chown -R mysql var
[root@localhost mysql]# chgrp -R mysql .
[root@localhost mysql]# ./bin/mysqld_safe --user=mysql &
[root@localhost mysql]# ./bin/mysqladmin -uroot password mysql
[root@localhost mysql]# cp ../mysql-5.0.51/support-files/my-large.cnf /etc/my.cnf
[root@localhost mysql]# cp ../mysql-5.0.51/support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@localhost mysql]# chkconfig --add mysql5
[root@localhost mysql]# chkconfig --level mysql5 345 on
[root@localhost mysql]# chkconfig --list mysqld5
[root@localhost mysql]#

vi /etc/rc.d/init.d/mysql5

修正下面的内容:

conf=/etc/my5.cnf

$bindir/mysqld_safe --defaults-file=/etc/my5.cnf --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &

vi /etc/my5.cnf修正相关的端口

port = 3307

版权声明:
原创作品,承诺转载,转载时请务必以超链接形式标明文章 原始理由 、作者信息和本声明。不然将穷究规律责任。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: