MySQL多实例安装文档 不指定

, 2007/08/14 23:02 , MYSQL , 评论(0) , 阅读(7850) , Via 本站原创 | |
平台说明:
192.168.200.102=>master
192.168.200.101=>slave
Mysql版本:Mysql 5.0.15
操作系统:Fc3 内核:2.6.9
引用
#groupadd mysql
#useradd -g mysql mysql
#cd /usr/local
#gunzip < /home/Linux/soft/mysql-standard-5.0.15-linux-i686-glibc23.tar.tar | tar xvf -
#ln -s mysql-standard-5.0.15-linux-i686-glibc23 mysql
#cd mysql
#scripts/mysql_install_db
#chown -R root .
#chown -R mysql data
#chgrp -R mysql .
#cp -a data data_1
#cp -a data data_2
#cp -a data data_3
#cp -a data data_4

#cd /usr/local/mysql/bin
#cat >my_multi.cnf
将下面配制文档粘贴my_multi.cnf中
引用
[mysqld_multi]
mysqld          = /usr/local/mysql/bin/mysqld_safe
mysqladmin      = /usr/local/mysql/bin/mysqladmin
user            = root

[mysqld1]
socket          = /tmp/mysql_5_1.sock
port            = 3301
pid-file        = /usr/local/mysql/data_1/hostname.pid
datadir         = /usr/local/mysql/data_1
log             = /usr/local/mysql/data_1/hostname.log
user            = mysql

[mysqld2]
socket          = /tmp/mysql_5_2.sock
port            = 3302
pid-file        = /usr/local/mysql/data_2/hostname.pid
datadir         = /usr/local/mysql/data_2
log             = /usr/local/mysql/data_2/hostname.log
user            = mysql

[mysqld3]
socket          = /tmp/mysql_5_3.sock
port            = 3303
pid-file        = /usr/local/mysql/data_3/hostname.pid
datadir         = /usr/local/mysql/data_3
log             = /usr/local/mysql/data_3/hostname.log
user            = mysql

[mysqld4]
socket         = /tmp/mysql_5_4.sock
port           = 3304
pid-file       = /usr/local/mysql/data_4/hostname.pid
datadir        = /usr/local/mysql/data_4
log            = /usr/local/mysql/data_4/hostname.log
user           = mysql

CTRL+D退出。
#vi /etc/profile #添加系统环境变量。
export MYSQL_HOME=/usr/local/mysql/bin
export PATH=$PATH:$MYSQL_HOME
重启让环境变量生效。
启动:
引用
#cd /usr/local/mysql
#mysqld_multi --config-file=/usr/local/mysql/bin/my_multi.cnf start 1,2,3,4

查看端口是否被监听
#netstat -lt |grep 33
tcp     0    0 *:3301      *:*       LISTEN      
tcp     0    0 *:3302      *:*       LISTEN
tcp     0    0 *:3303      *:*       LISTEN      
tcp     0    0 *:3304      *:*       LISTEN
停止某实例的mysql
#mysqld_multi  --config-file=/usr/local/mysql/bin/my_multi.cnf stop 1,2,3,4
访问方法:
#mysql -u root -S /tmp/mysql_5_1.sock -p
添加
#mysqld_multi --config-file=/usr/local/mysql/bin/my_multi.cnf start 1,2,3,4
至/etc/rc.local开机自动启动。
Tags: ,
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]