您的位置:首页 > 博客中心 > 数据库 >

Installing Multiple Versions of MySQL

时间:2022-03-13 23:56


This posts reviews my preferred way of accomplishing this for MySQL on Linux. The server in question already has a previous 4.X.X version of MySQL. Rather than overwrite this, I would like to install 5.1.23, decoupling it from the existing MySQL installation. In order to do this, I will be compiling MySQL from a source distribution specifying a custom TCP port as well as custom file locations, etc. Following this scheme, you could install many different versions of MySQL on a single server.

Here are the steps I followed:

Download the desired source distribution: 


As root, create any necessary directories, transfer to server, gunzip, and extract:

Make the necessary directories for the installation, initially all owned by root:

Configure and make from the source‘s base directory; I normally place the configure and make steps into a script:


Modify the values to suit your environment and then execute the script:

Install the MySQL system tables:

Change the ownership of key directories:

Create a custom .cnf file and modify the appropriate values:

Alter the following values:

Start MySQL manually via mysqld_safe to test:

Configure this particular server for automatic startup/shutdown:

The mysql.server script looks for your option file in your $basedir; to support this, move the previously created option file into the$basedir:

Now your service is configured to automatically start and stop with the appropriate system run levels; optionally you can start and stop manually via:

Confirm your installation‘s variables:

Post Configuration Steps

Drop the test database:

Specify password for the root account and drop the anonymous users:

Create an admin user besides root (I will use the oracle account on my machine):

Optionally, set-up the alternate admin user‘s Unix environment and test:

Alter appropriate profile with

Create .my.cnf in the $HOME directory

Test connection


At this point, your sandbox should be ready to go...


本文出自 “” 博客,请务必保留此出处

热门排行

今日推荐

热门手游