首页 > 代码库 > 单服务器多mysql服务器

单服务器多mysql服务器

#mkdir  /home/mysql_servers/mysql330{7,8,9}  -p

#useradd -g mysql mysql3307 -s /bin/nologin -d /home/mysql_servers/mysql3307

#tar xf mysql.tar.gz

#cd mysql/

#./configure  --prefix=/home/mysql_servers/mysql3307

#make

#make install

#cp mysql3307/share/mysql/my-medium.cnf  mysql3307/my.cnf

#vi mysql3307/my.cnf   --以下列出一部分修改了的地方

[client]

#password = your_password

port = 3307

socket = /tmp/mysql3307.sock

[mysqld]

port = 3307

socket = /tmp/mysql3307.sock

datadir = /home/mysql_servers/mysql3307/data

log-error = /var/log/mysqld3307.log          --打出错误日志文件 ,以便排错

pid-file = /home/mysql_servers/mysql3307/3307.pid

log-bin=/home/mysql_servers/mysql3307/data/mysql-bin


数据库初始化:

#/home/mysql_servers/mysql3307/bin/mysql_install_db --basedir=/home/mysql_servers/mysql3307/ --datadir=/home/mysql_servers/mysql3307/data  --user=mysql3307


启动mysql:   --一定要注意,配置my.cnf   打出错误日志,

# /home/mysql_servers/mysql3307/bin/mysqld_safe --defaults-file=/home/mysql_servers/mysql3307/my.cnf --user=mysql3307 &

    

关闭mysql服务:

#/home/mysql_servers/mysql3307/bin/mysqladmin -uroot -p  -S /tmp/mysql3307.sock shutdown




本文出自 “石头记” 博客,请务必保留此出处http://dodowolf.blog.51cto.com/793581/1572698

单服务器多mysql服务器