Multiple MySQL servers on RHEL5

Install MySQL 5

I did this with the standard RHEL rpm install.  yum install mysql-server

I left the install with all defaults in the my.cnf

Install MySQL4

The trick here is to configure MySQL 4 with a new UNIX socket path and a new port number. Note this is only one way to do it. If you had multiple IP addresses on a system you could configure MySQL to listen on a specific IP and port. In addition, if you needed multiple instances of MySQL 5 you could re-use the initial mysql instance and spawn off a new instance on a new port and socket.

So I downloaded mysql-4.XXX.tar.gz.  I extracted it and moved into that directory: cd /usr/local/mysql-XXX

I chose to install into /usr/local/mysql, on port 3308.

I ran this command before my ./configure below. Not sure if it was necessary or not:

CFLAGS=”-O3″ CXX=gcc CXXFLAGS=”-O3 -felide-constructors -fno-exceptions -fno-rtti”

Here are my configure options:

sudo ./configure –prefix=/usr/local/mysql –exec-prefix=/usr/local/mysql –with-unix-socket-path=/usr/local/mysql/mysql.sock –with-tcp-port=3308 –with-plugins=all

Then I ran a make all install.  I had issues with running mysql_install_db and it was not creating the tables correctly. I found this post (http://forums.mysql.com/read.php?11,51024,100061#msg-100061) and ran the command as follows:

./mysql_install_db –user=mysql –ldata=/usr/local/mysql/data

I had to copy the my.cnf from /usr/local/mysql-XXX/support-scripts/my-medium.cnf and put it into /usr/local/mysql/etc/my.cnf

I updated the my.cnf as follows:

[client]
#password       = your_password
port            = 3308
socket          = /usr/local/mysql/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port            = 3308
socket          = /usr/local/mysql/mysql.sock
datadir         = /usr/local/mysql/data
skip-locking

Comment out bin-log as this is also a replication slave I am playing with.

[mysqld_safe]

log-error=/var/log/mysqldv4.log

pid-file=/usr/local/mysql/var/run/mysqld.pid

Then I HAD TO stop the mysql version 5 server before I could start the mysql 4 server.

I was then able to start the MySQL 4 server with the following command:

sudo /usr/local/mysql/bin/mysqld_safe –defaults-file=etc/my.cnf &

Note: If you are using the –defaults-file it needs to be the first option.  mysqld_safe will not recognize other options after it.

Finally I created a symlink from /usr/local/mysql/bin/mysql to /usr/bin/mysql-v4 for easy access to my mysql 4 server.

Now on to configuring my MySQL slave

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