Hot File

Create Set Up Master And Slave MYSQL

View: 318    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: MySQL   Fields: Other

9 point/2 review File has been tested

In this tutorial I am going to teach you one of the most important MySQL techniques that you must use in your software development

Introduction

In this tutorial I am going to teach you one of the most important MySQL techniques that you must use in your software development.

Today huge amount of business use MySQL as their data base. Imagine if their database corrupted what would be happen ?, If your server crashed what word you do ? So we must use database backup technique to overcome those issues.

Now I am going to explain you one of the best solution for above issue is master slave replication for MySQL . That’s mean you have to copies of same database one as master and other as slave. In this scenario you always dealing with master for your needs but you have up to date backup as slave.
I am here going to used ubuntu and MySQL 5.5
How to set the master

If you have brand new server update APT cash and update server

sudo apt-GET UPDATE; 
sudo apt-GET install mysql-server

Then open open up the my.cnf file which contained database configuration

sudo vim /etc/mysql/my.cnf

Then change the following line

bind_address = 127.0.0.1

To

bind_address = 0.0.0.0

Upto now what we have done is set the mysql listning all the IP addresses
Also uncomment following lines

server-id = 1
   log_bin = /var/log/mysql/mysql-bin.log

First line we are removing server id
Second line we are removing current backup mechanism. That is LOG After you done this restart the mysql

sudo service mysql restart

Then log into database as root with password

mysql -u root -p

At thefinal step we need to add user account for the slave. This user account help slave login to master and do operations

GRANT REPLICATION SLAVE ON *.* TO ‘replication’@’192.168.2.2 IDENTIFIED BY ‘password’;

Setting up slave
At first we need to clear APT cash and installed MySQL

sudo apt-GET UPDATE; sudo apt-GET install mysql-server

During the installation you need to provide password.After that open my.cnf file

sudo vim /etc/mysql/my.cnf

Uncomment following line

server-id = 2

Save the file and you need to restart mysql server

sudo service mysql restart

Then log in to with your password

mysql -u root -p

Use following query to set up master slave relation

CHANGE MASTER TO MASTER_HOST=’192.168.2.2′, MASTER_USER=’replication’, MASTER_PASSWORD=’password’;

After that start the slave

SLAVE START;

Then you can test the status of slave

SHOW SLAVE STATUS;

Above will prompt “Waiting for master to send event” .Then create database on master and after that give following quarry to slave

Create Set Up Master And Slave MYSQL

Create Set Up Master And Slave MYSQL Posted on 07-01-2016  In this tutorial I am going to teach you one of the most important MySQL techniques that you must use in your software development 4.5/10 318

Comment:

To comment you must be logged in members.

Files with category

  • SQL Query to Find Nth Highest Salary of Employee with java

    View: 329    Download: 0   Comment: 0   Author: none  

    SQL Query to Find Nth Highest Salary of Employee with java

    Category: MySQL
    Fields: Other

    0/0 review
    This is a very common interview question if you are going for the role at junior level. Most of the people learn it character by character, but few understand how this query works.

  • World OOP With PHP and MySQL

    View: 1089    Download: 0   Comment: 0   Author: none  

    World OOP With PHP and MySQL

    Category: MySQL
    Fields: Other

    0.32142857142857/14 review
    Setting up the skeleton of our class is fairly simple once we figure out exactly what we need.

  • How to Build a Newsletter System With PHP and MySQL

    View: 1395    Download: 0   Comment: 0   Author: none  

    How to Build a Newsletter System With PHP and MySQL

    Category: MySQL
    Fields: Other

    1.125/4 review
    When starting any project, I like to layout the folders before I start coding, so lets do that now.

  • Top 20+ MySQL Best Practices that can not be ignored

    View: 1024    Download: 0   Comment: 0   Author: none  

    Top 20+ MySQL Best Practices that can not be ignored

    Category: MySQL
    Fields: Other

    1.6666666666667/3 review
    Database operations often tend to be the main bottleneck for most web applications today.

  • Create a PHP/MySQL Powered Forum from Scratch

    View: 1243    Download: 0   Comment: 0   Author: none  

    Create a PHP/MySQL Powered Forum from Scratch

    Category: MySQL
    Fields: Other

    1.5/3 review
    In this tutorial, we're going to build a PHP/MySQL powered forum from scratch.

  • Triggers Introduction to MySQL

    View: 361    Download: 0   Comment: 0   Author: none  

    Triggers Introduction to MySQL

    Category: MySQL
    Fields: Other

    1.6666666666667/3 review
    I would guess, even armed with this knowledge, that a good many of you are not taking advantage of triggers with MySQL.

  • How to Stored Procedures in MySQL 5

    View: 361    Download: 0   Comment: 0   Author: none  

    How to Stored Procedures in MySQL 5

    Category: MySQL
    Fields: Other

    2.25/2 review
    MySQL 5 introduced a plethora of new features - stored procedures being one of the most significant. In this tutorial, we will focus on what they are, and how they can make your life easier.

  • The strength of the PDO and. MySQLi: Which Should You Use?

    View: 368    Download: 0   Comment: 0   Author: none  

    The strength of the PDO and. MySQLi: Which Should You Use?

    Category: MySQL
    Fields: Other

    1.5/3 review
    When accessing a database in PHP, we have two choices: MySQLi and PDO. So what should you know before choosing one?

 
Newsletter Email

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd