Multiple instances of mysql same version

# mkdir /etc/mysql

# /etc/mysql/dev.cnf (Instance name)

[mysqld]
bind-address = IP Address
datadir=/data/mysql-dev
socket=/data/mysql-dev/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
general-log-file=/var/log/mysqld_dev.log
general-log=on

[mysqld_safe]
log-error=/data/mysql-dev/error.log
socket=/data/mysql-dev/mysql.sock

# Make a datadir and /etc/mysql/dev .cnf file for all instances you would like such as stg and prod etc.

# Edit default mysql init script with the following differences

45a46,47
> conffile=dev.cnf
> confdir=/etc/mysql
47c49,50
< datadir=

> datadir=/data/mysql-dev/
> mysqld_pid_file_path=/data/mysql-dev/mysqld.pid
63d65
< mysqld_pid_file_path=
283c285
< $bindir/mysqld_safe –datadir=”$datadir” –pid-file=”$mysqld_pid_file_path” $other_args >/dev/null 2>&1 &

> $bindir/mysqld_safe –defaults-file=$confdir/$conffile –datadir=”$datadir” –pid-file=”$mysqld_pid_file_path” $other_args >/dev/null 2>&1 &
384a387
>

# touch /var/log/mysqld_dev; chown mysql:mysql /var/log/mysqld_dev

# mkdir /data/mysql-dev; chown -R mysql:mysql /data/mysql-dev

# Run: /usr/bin/mysql_install_db –datadir=/data/mysql-dev

# chown -R mysql:mysql /data/mysql-dev/

# Create the necessary binaries

# vi /usr/bin/mysql-dev

# Insert: /usr/bin/mysql -S /data/mysql-dev/mysql.sock $@

# vi /usr/bin/mysqldump-dev

# Insert: /usr/bin/mysqldump -S /data/mysql-dev/mysql.sock $@

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s