博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

Unix爱好者家园

   sdccf.cublog.cn
关于作者  
姓名:sdccf
职业:chinapost
年龄:36
位置:sd
个性介绍:

我的分类  




同一台服务器安装两个mysql(不同端口)
作者: 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

 发表于: 2008-05-28,修改于: 2008-05-28 10:11 已浏览261次,有评论1条 推荐 投诉

  网友评论
  zhongguanqun 时间:2008-06-12 20:38:48 IP地址:218.62.2.★
我看了你写的,有些地方没看懂,我用的是redhat enterprise 3.0我先装的是myuslq4.0.26后来由于实际的需要我需要再装一个mysql5.0.37,但是我的mysql4.0.26是rpm包安装的你写的有些地方我对不上,希望能指教一下,我的email:zhongguanqun@126.com,如果你能来信告诉我我回非常感激你的!
我的QQ:44320299


  发表评论



Copyright © 2001-2006 ChinaUnix.net All Rights Reserved

感谢所有关心和支持过ChinaUnix的朋友们
页面生成时间:0.36498

京ICP证041476号