Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 11.06 minutes in March 2021 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

Running Multiple MySQL versions

by | May 18, 2006

Sometimes we may require to run multiple versions of MySQL on the same Server. This can happen if you either need to test a new MySQL release or you need a new MySQL version and you don’t want to make any changes to the existing system.

The whole idea behind this is to compile the new MySQL server with different TCP/IP ports and Unix socket files so that each one is listening on different network interfaces. Compiling in different base directories for each installation also results in separate compiled-in data directory, log file, and PID file location for each server.

 

Hire Bobcares Linux Server Administrators
Get super reliable servers and delighted customers

See how we do it!

 

 

First download the source the tar file from mysql.com.

$> tar xfz mysql.tar.gz
$> cd mysql.XX

* Important **
“/etc/my.cnf ” is the default file that is used by a mysql server. When the new version is tested it will load the default configuration’s in /etc/my.cnf.

To resolve this I replaced every instance of ” cnf ” inside the source folder to ” conf ” by using this following command.

find ./ -type f | xargs perl -pi -w -e 's/cnf/conf/g;'

1) The default user generally is “mysql”. Add another user and group for example mysqlt for the new version of MySQL.

2) A typical ./configure command…

./configure --prefix=/usr/local/mysql --enable-local-infile
--with-tcp-port=4444 --with-mysqld-user=mysqlt
--with-base_dir=/usr/local/mysql --with-log=/usr/local/mysql/mysqld.log
--with-pid_file=/usr/local/mysql/mysqld.pid
-with-unix-socket-path=/tmp/mysqlt.sock --localstatedir=/var/lib/mysqlt

The new values you will use for your new MySQL server are:

Port number : 4444

mysql user : mysqlt

base_dir :  /usr/local/mysql

data directory : /var/lib/mysqlt

log file : /usr/local/mysql/mysqld.log

3) Compile and Install

make && make install

4)Create your new MySQL config file.

cp support-files/my-medium.conf /etc/my.conf
cd /usr/local/mysql
bin/mysql_install_db --user=mysqlt
( this will install all the needed databases )
bin/mysqld_safe --user=mysqlt &

TO SET A PASSWORD FOR THE MySQL root USER

/usr/local/mysql/bin/mysqladmin -u root -h hostname password 'new-password'

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'

5) To start the service

cd /usr/local/mysql

./share/mysql/mysql.server start

6) To test

#telnet localhost 4444

and you should see this
Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

+ 4.0.26-logIE^*THL

And you are done. You can copy mysql.server >> rc.d to start it when the server is rebooted.

With these steps, you can download and configure different mysql versions to use different values for port, datadirectory, mysql user, configuration file etc….

Warning: You should never have two servers that update data in the same databases.


About the author:
Lincy Reymond is a Linux system administrator who works for Bobcares.

She specializes mainly on Linux Plesk Servers


2 Comments

  1. Hi
    we have installed in Mysql-4.1.19 in LinuxRHEL3 ,But i want to install 5.1.30 as a second instance,i am trying to install as per your documentation ,it is saying more error,could you please send me setup procedure in detailed .Kindly help me in this issue.
    regards
    chandrasekar

  2. Hi Lincy, your how to helped me on installing multi instance on a Fedora 17 box, now I have mysql 5 and 4 installed but only with your tutorial I couldn’t get the job done, but for sure here is the base. I even goin’to’write a tutorial in my blog for my native language (pt-BR) Thanks a lot.

Trackbacks/Pingbacks

  1. Twitter Trackbacks for Bobcares Blog [bobcares.com] on Topsy.com - [...] Bobcares Blog bobcares.com/blog/?p=91 – view page – cached Bobcares.com provides Quality Outsourced Technical Support to Hosting companies and Datacenters…

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF