How to configure MySQL Master-Slave Replication in RHEL 6.X/Centos 6.X
Working Linux OS
like CentOS
6.3, RedHat
6.3 or Fedora
17
Master and Slave are CentOS
6.3 Linux Servers.
Master IP Address is: 10.65.62.30
Slave IP Address is: 10.66.191.232
Master and Slave are on the same
LAN network.
Master and Slave has MySQL
version installed.
- Master allow remote MySQL connections on
port 3306.
Master side (10.65.62.30):
[root@station1 Desktop]# yum install -y
mysql*
[root@station1 Desktop]# service mysqld
start
[root@station1 Desktop]# mysqladmin -u
root password password ------> setting password for the root
user
[root@station1 Desktop]# mysql -u root
-ppassword ------> login
Welcome to the MySQL monitor. Commands
end with ; or \g.
Your MySQL connection id is 15
Server version: 5.1.52 Source
distribution
Copyright (c) 2000, 2010, Oracle and/or
its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO
WARRANTY. This is free software,
and you are welcome to modify and
redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type
'\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> use mysql;
Reading table information for
completion of table and column names
You can turn off this feature to get a
quicker startup with -A
Database changed
mysql> DELETE FROM mysql.user WHERE
user = ''; ----> to delete anonymous users.
mysql> flush privileges;
mysql> create database Ranjith;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| Ranjith |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> use Ranjith;
Reading table information for
completion of table and column names
You can turn off this feature to get a
quicker startup with -A
Database changed
mysql> create table contacts (
`first_name` char(20), `last_name` char(20), `mob_no` char(20),
`email_id` char(30), PRIMARY KEY (`email_id`));
mysql> show tables;
+-------------------+
| Tables_in_Ranjith |
+-------------------+
| contacts |
+-------------------+
1 row in set (0.00 sec)
mysql> describe contacts;
+------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key |
Default | Extra |
+------------+----------+------+-----+---------+-------+
| first_name | char(20) | YES | |
NULL | |
| last_name | char(20) | YES | |
NULL | |
| mob_no | char(20) | YES | |
NULL | |
| email_id | char(30) | NO | PRI |
| |
+------------+----------+------+-----+---------+-------+
4 rows in set (0.00 sec)
mysql> INSERT INTO contacts
(first_name,last_name,mob_no,email_id) VALUES
('Ranjith','Pandurangan','+918056316316','upload.vellore@licindia.com');
mysql> select * from contacts;
+------------+-------------+---------------+----------------------+
| first_name | last_name | mob_no
| email_id |
+------------+-------------+---------------+----------------------+
| Ranjith | Pandurangan |
+918056316316 | upload.vellore@licindia.com |
+------------+-------------+---------------+----------------------+
2 rows in set (0.00 sec)
mysql>quit;