![]() The next step is to stop the slave so you can finish up the Slave configuration. Now exit the mysql prompt with the command quit. Now from the mysql prompt enter the following command: ![]() Here are the commands to load the data:Įnter the mysql admin password. This is when the database will be locked. Now we have to load the data from the Master into the Slave. Save that file and restart mysql on the slave with the command: #Hmail change mysql database server password#Where IP_ADDRESS_OF_MASTER is the actual IP address of the master server, USER is the user created on the master for replication, and USER_PASSWORD is the password given to the replication user on the Master. Now to configure MySQL to know it is the slave and open up the /etc/mysql/my.conf file for editing. Now enter the following command to create the database: On the slave open up the mysql shell with: The first thing to do on the Slave is to create the database the Master will write to. Move over to the machine that will serve as the slave. To that end the database will be unavailable until the database is unlocked. The method I will show you requires that the database on the Master be locked momentarily. Now you need to get tables and data from the sample_database. Write this information down (you will see a Position number that you will need later). When you issue the above command you should see a listing printed out for your sample_database. Now issue the command:Īnd now you need to make sure mysql is seeing the Master and can show the status of the master with the command: Where NEW_PASSWORD is the actual password and USER is the actual username that will have replication privileges. GRANT REPLICATION SLAVE ON *.* TO IDENTIFIED BY '' ![]() From the mysql prompt issue the following: You will prompted for the mysql admin password. ![]() The next step is to log into the mysql terminal and create a user that has replication privileges. You will need root access as well as access to the database administrator on both machines.įor purpose of example our database to replicate will be called "sample_database".? The first thing you need to do is open up the /etc/mysql/my.conf file for editing. The Slave is the machine that holds the replicated database (the backup per say.) Both machines must have a working MySQL installation and must be networked together. The Master is the machine that holds the original database. When using replication you think of your machines as Master and Slave. The reason you want to use two machines is to ensure you will always have a working copy of your database (should one machine die). #Hmail change mysql database server update#That method is database replication.Replication is a way to configure a MySQL database to update on a remote server whenever the local client is updated.ĭatabase replication will require the use of two machines. There is a method that ensures you will always have an up to date backup. But backing up a database and being able to use that backup depends upon the back up being always up to date. If you use databases then you know how important it is to back them up. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |