Install and deploy multiple MySQL instances in Linux

Source: Internet
Author: User
On LAMP and LNMP platforms, data is stored in MySql databases. MySql versions 3.23.15 and later provide a master-slave synchronous replication mechanism.

On LAMP and LNMP platforms, data is stored in MySql databases. MySql versions 3.23.15 and later provide a master-slave synchronous replication mechanism.

Currently, LAMP and LNMP are two popular open-source Linux Web Services. Known as free and efficient, it is the preferred server architecture for many websites and Web systems.

Business data is often a valuable resource. The damage and loss of business data is a major loss for enterprises. Therefore, it is particularly important to back up and restore business data in real time.

On LAMP and LNMP platforms, data is stored in MySql databases. MySql versions 3.23.15 and later provide a master-slave synchronous replication mechanism, which enables real-time data backup. This technology can also be used for data read/write splitting to improve efficiency. Therefore, in general, it is generally a Web server with three DBS.

You may have a sufficient budget. You can purchase three DB servers to meet your business needs, or you may have insufficient funds. You can only purchase two DB servers or even one DB server. Then, there must be a server running at least two database examples.

This article focuses on how to quickly deploy multiple MySql database instances on a Linux server. The software is as follows:

1. Operating System: RedHat Linux 5.4 Enterprise

2. MySql version: MySql-5.1.44

Let's start.

1. Obtain MySql compiled binary program files and related configuration files

There are three ways to obtain compiled binary program files. The first is to download the compiled binary version directly on the MySql official website, and the second is to extract the compiled binary version on the server where the MySql database has been installed, third, download the source code package and compile it yourself to obtain the compiled binary version.

This document uses the second method to extract compiled MySql files from the installed MySql Server (the installation adopts the local source code compilation form ).

Extraction Method:

1.1 log on to the MySql server and obtain the MySql installation path. You can use the following command on the mysql console to obtain the installation path:

Show variables like '% basedir % ';

The query result is as follows:

We can see that our MySql is installed in the/usr/local/mysql/directory. After obtaining the mysql installation path, you can start extracting MySql files.

1.2 log on to the linux server where mysql is installed and go to the mysql installation directory. The directory to be accessed is/usr/local /.

The command is as follows:

Cd/usr/local

The operation result is as follows:

You can use the pwd command to view the current directory location. The operation commands are as follows:

Pwd

The operation result is as follows:

We can see that we are currently in the/usr/local directory. Now let's take a look at the folders and files in the directory. The command is as follows (two lower-case letters of L ):

Ll

The operation result is as follows:

In the operation file and folder list, we can see the mysql Directory, which is the installation directory of mysql.

1.3 extract mysql installation files

After MySql is found, the next step is to package the mysql folder and all the subfolders and files below. Package the tar commands that we use in linux. The command is as follows:

Tar-zcf/root/mysql-noinstall-5.1.44.tar.gz mysql

Command Format: Path of the file storage path to be packaged after the tar parameter is packaged

The operation result is as follows:

Here, because the v parameter is not added to the parameter, the detailed steps for listing the package file are not listed, but the file is indeed packaged and put under/root. You can go to the/root directory. The command is as follows:

Cd #

Ll

The operation result is as follows:

As you can see, the mysql-noinstall-5.1.44.tar.gz file has been created. The next step is to transfer the file to the server where mysql is to be installed. There are many transmission methods. You can choose a method you are used to, as long as the file is copied.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.