wget 二进制的源码包
解压
cat INSTLL-BINARY
根据说明操作,具体安装步骤请看 http://www.lishiming.net/thread-7-1-1.html
其中1-4步骤是相同的,第5步,也是最重要的一步,要初始化数据库
因为是多个端口,所以要根据配置文件来初始化多个数据库
比如说有2个端口
则要运行两次
./scripts/mysql_install_db --datadir=/home/mysql1 --user=mysql
./scripts/mysql_install_db --datadir=/home/mysql2 --user=mysql
配置文件要编辑成这样
[mysqld0]
port = 3300
socket = /tmp/mysql0.sock
pid-file = /home/mysql0/localhost.localdomain0.pid
datadir = /home/mysql0
#log = /data/mysql0/mysql0.log
user = mysql
skip-locking
skip-name-resolve
#skip-bdb
#skip-innodb
key_buffer = 128M
max_allowed_packet = 1M
table_cache = 864
sort_buffer_size = 1M
read_buffer_size = 512K
read_rnd_buffer_size = 1M
myisam_sort_buffer_size = 32M
thread_cache_size = 16
query_cache_size = 32M
thread_concurrency = 8
#skip-networking
wait_timeout=8
max_connections=512
max_connect_errors = 10000000
max_user_connections=20
#slow_queries=/data/mysql0slowquer.sql
#log_slow_queries=/data/mysql0slowquer.sql
#long_query_time=3
#log-bin=mysql0-bin
###########################
[mysqld1]
port = 3301
socket = /tmp/mysql1.sock
pid-file = /home/mysql1/localhost.localdomain1.pid
datadir = /home/mysql1
#log = /data/mysql1/mysql1.log
user = mysql
skip-locking
skip-name-resolve
#skip-innodb
#skip-bdb
key_buffer = 128M
max_allowed_packet = 1M
table_cache = 864
sort_buffer_size = 1M
read_buffer_size = 512K
read_rnd_buffer_size = 1M
myisam_sort_buffer_size = 32M
thread_cache_size = 16
query_cache_size = 32M
thread_concurrency = 8
#skip-networking
wait_timeout=8
max_connections=512
max_connect_errors = 10000000
max_user_connections=20
#log_slow_queries=/data/mysql1slowquer.sql
#long_query_time=3
#log-bin=mysql1-bin
########################################
把配置文件放在 /etc/my.cnf
最后就该启动了
/usr/local/mysql/bin/mysqld_multi start 0-1 这里的0或1是根据配置文件中"[mysqld0]"来定的。
本文出自 “小杨” 博客,请务必保留此出处http://aqiang.blog.51cto.com/6086626/1896093
原文地址:http://aqiang.blog.51cto.com/6086626/1896093