Home > Database > Mysql Tutorial > 启动多个mysqld-HOWTO_MySQL

启动多个mysqld-HOWTO_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:59:34
Original
1073 people have browsed it

为达到启动多个mysqld服务,只要启动时使用不同pid-file,datadir,socket,port是完全的可行。
步骤:
1、准备目录
mkdir /mysql1
chown mysql:mysql /mysql1
chmod 755 mysql /mysql1
2、准备新的服务要读取的数据库
cp /path/to/mysql/var /mysql1
3、创建mysqld启动脚本
#start_msyql
#!/bin/sh
rundir="{GetProperty(Content)}"
port="$2"
echo "$rundir"
/www/mysql/bin/safe_mysqld --user=mysql --pid-file="$rundir"/mysql.pid 

--datadir="$rundir"/var -O max_connections=500 -O wait_timeout=600 -O key_buffer=32M 

--port="$port" --socket="$rundir"/mysql.sock &
说明:
脚本使用方法./start_mysql /mysql1 3307
./start_mysql dir port
dir:指的是mysql数据库及运行时产生的文件所在目录
port:指新的mysqld监听的端口

4、创建mysqld的停止脚本
#stop_mysql
#!/bin/sh
rundir="{GetProperty(Content)}"
echo "$rundir"
/www/mysql/bin/mysqladmin -u root -p -S"$rundir"/mysql.sock shutdown

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template