Detailed steps for copying and configuring MySQL5.5 under CentOS5.8

Source: Internet
Author: User
Detailed steps for copying the configuration of MySQL5.5 under CentOS5.8, operating system: CentOS5.8, MySQL version: 5.5.x, target: Master-master replication. Set the two database servers to Master, master, and Replay

Detailed steps for MySQL 5.8 replication configuration under CentOS 5.5, operating system: CentOS 5.8, MySQL version: 5.5.x, target: Master-master replication. Set the two database servers to Master, master, and Replay

Operating System: CentOS 5.8

MySQL version: 5.5.x

Original condition: the database is on one machine and some production data already exists.

Target: Master-master replication. The two database servers are set to master-master replication, that is, changes made to any database server are automatically synchronized to the other database server.

First server: IP Address: xxx. xxx. xxx.156 host name s156

Second server: IP Address: xxx. xxx. xxx.170 host name s170

Note: The IP addresses in this article are all in the form of xxx. When used, they are modified according to the actual situation.

Step 1: Stop the application

Before modifying the mysql configuration, stop the database-related processes (programs), for example:

1. tomcat or other Web application containers

Stop using service tomcat stop

Or go to tomcat/bin to execute./shutdown. sh)

2. Some database-related scheduled tasks set in crontab.

For example, scheduled tasks that check whether tomcat is started.

You can first open crontab-e and comment out the corresponding items (add the # sign in front ).

3. Other database-related processes.

Step 2: Check the Host Name

Under what circumstances do I need to modify the host name?

If the shell command line prompt is

[Root @ localhost ~] #

Or run the hostname command to obtain the Host Name: localhost.

[Root @ localhost ~] # Hostname
Localhost

Why should I check whether the host name is correct?

1. In some cases, the installation system is relatively lazy and the host name is not set during installation;

2. host names are required to generate log files during mysql running, especially after replication;

3. If you modify the Host Name After configuring replication, it will cause mysql execution errors, which I have encountered.

If you do not need to modify the host name, skip to the next step.

Note: Check and modify the two servers.

To modify the host name, follow these steps:

1. Stop the program or service related to the host name, such as mysql (the log file name generated by this tool contains the host name)

Service mysql stop

2. Run the hostname command to modify the Host Name (assuming that the new host name is newname)

Hostname newname

For example, hostname s156

3. Configure host name resolution in the/etc/hosts file (assuming that the ip address is recorded as ip, host name newname, and domain name is yourdomain.com)

127.0.0.1 localhost. localdomain localhost
: 1 localhost6.localdomain6 localhost6

Ip newname.yourdomain.com newname

For example: xxx.156 s156

4.Modify HOSTNAME = newname in/etc/sysconfig/network

For example, HOSTNAME = s156

5. It is best to restart the machine. If not, you can log on again.

Restart the reboot command

Log on again and use the exit command.

6. Check whether the command line prompt and hostname are correct.

[Root @ s156 ~] # Hostname
S156

7. Restart the program or service that is stopped in step 1, such as mysql.

Service mysql start

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.