Chinaunix首页 | 论坛 | 博客
  • 博客访问: 580764
  • 博文数量: 43
  • 博客积分: 10257
  • 博客等级: 上将
  • 技术积分: 480
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-06 02:16
文章分类

全部博文(43)

文章存档

2011年(5)

2010年(12)

2009年(6)

2008年(20)

分类: Mysql/postgreSQL

2008-06-12 14:10:45

1. 首先在MySQL安装目录下拷贝一份MySQL,这里安装在/usr/local/mysql下,拷贝的那份为/usr/local/mysql2。

MySQL1使用端口为:3306

      数据库存放:/usr/local/mysql/data

      使用套接字:/usr/local/mysql/mysql.sock

MySQL2使用端口为:3307

      数据库存放:/usr/local/mysql2/data

      使用套接字:/usr/local/mysql2/mysql.sock2

[root@lvdbing.net ~/conf]$ cat my.cnf
# Example MySQL config file for large systems.
#
# This is for a large system with memory = 512M where the system runs mainly
# MySQL.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /usr/local/mysql/data) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients

[mysqld_multi]
mysqld=/usr/local/mysql/bin/mysqld_safe
user=lvdbing

[mysqld1]
port = 3306
socket = /usr/local/mysql/mysql.sock
datadir =  /usr/local/mysql/data
skip-locking
key_buffer = 256M
max_allowed_packet = 5M
table_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency

thread_concurrency = 8
basedir =/usr/local/mysql/
user = lvdbing


[mysqld2]
port = 3307
socket = /usr/local/mysql2/mysql.sock2

datadir = /usr/local/mysql2/data

skip-locking
key_buffer = 256M
max_allowed_packet = 5M
table_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency

thread_concurrency = 8
basedir = /usr/local/mysql2
user = lvdbing

# Don't listen on a TCP/IP port at all. This can be a security enhancement,

# if all processes that need to connect to mysqld run on the same host.

# All interaction with mysqld must be made via Unix sockets or named pipes.

# Note that using this option without enabling named pipes on Windows

# (via the "enable-named-pipe" option) will render mysqld useless!

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL

#safe-updates


[isamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

 

接着使用命令mysqld_multi启动就行了:

 

[root@lvdbing.net bin]$ /usr/local/mysql/bin/mysqld_multi --config-file=/etc/my.cnf start 1-2

阅读(1619) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~