Ubuntu MySQL Hot Backup installation (1)

Source: Internet
Author: User
Tags administrator password

References:

Http://www.cnblogs.com/wuhou/archive/2008/09/28/1301071.html

Http://www.hebaodans.com/2009/02/m-y-s-q-l-shu-ju-ku-de-tong-bu-wen-ti-shuang-ji-re-bei/

1. Install the latest Ubuntu Server version and update the system.

2. Install MySQL Server: sudo apt-get instal mysql-server, set the administrator password, and remove the local address binding for remote access.

MASTER: 192.168.137.12

From: 192.168.137.13

3. Set the utf8 character set to support Chinese characters. Add the following to the configuration file/etc/mysql/my. cnf of the Master/Slave Server:

[Client]
Default-character-set = utf8

[Mysqld]
Default-character-set = utf8

Init_connect = 'set NAMES utf8 ;'

4. Start the backup on the server. First, add the following content to the configuration file of the master server. S3 (for example) is the database to be synchronized.

[Mysqld]

Log-bin = mysql-bin
Server-id = 1
Binlog-do-db = s3

5. Restart the primary database.

Sudo service start mysql

6. Connect to the primary database and create the database to be synchronized. If the database already exists, ignore this step.

Mysql-u root-p

Create database s3;

7. It is important to add an account (sync) to the server to synchronize the database and grant the backup permission.

Grant replication slave on *. * to 'sync' @ '%' identified by '123'

8. record the name and location of the log file of the s3 database for the location starting from the backup.

Mysql> show master status;
+ ------------------ + ---------- + -------------- + ------------------ +
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+ ------------------ + ---------- + -------------- + ------------------ +
| Mysql-bin.000007 | 106 | s3 |
+ ------------------ + ---------- + -------------- + -----------------

9. modify the configuration file of the slave machine.

[Mysqld]
Server-id = 2
Read-only
Master-connect-retry = 60
Replicate-do-db = s3

10. Restart the slave machine, create a database (s3), or restore the database from the original database. Run the following command:

Change master to MASTER_HOST = '192. 168.137.12 ', MASTER_USER = 'sync', MASTER_PASSWORD = '000000', MASTER_LOG_FILE = 'mysql-bin.000007', MASTER_LOG_POS = 192;


Related Article

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.