Database replication is the process of copying and maintaining database objects, like tables and data, from one database server (master) to another (slave) to keep them synchronized.
Click to reveal answer
beginner
What roles do the master and slave servers play in MySQL replication?
The master server records all changes to its data and sends them to the slave server. The slave server receives these changes and applies them to its own data to stay up-to-date.
Click to reveal answer
intermediate
What is the binary log (binlog) in MySQL replication?
The binary log is a file on the master server that records all changes made to the database. It is used to send these changes to the slave server for replication.
Click to reveal answer
beginner
Why is replication useful in real life?
Replication helps keep copies of data in different places for backup, faster reading by spreading load, and high availability if one server fails.
Click to reveal answer
advanced
What is the difference between asynchronous and semi-synchronous replication?
In asynchronous replication, the master does not wait for the slave to confirm it received changes. In semi-synchronous replication, the master waits for at least one slave to confirm before continuing, improving data safety.
Click to reveal answer
In MySQL replication, which server sends the data changes to the other?
AMaster server
BSlave server
CBoth servers simultaneously
DNeither server
✗ Incorrect
The master server records changes and sends them to the slave server.
What does the binary log (binlog) store in MySQL replication?
AUser passwords
BAll database changes
CBackup files
DServer configuration
✗ Incorrect
The binary log stores all changes made to the database on the master.
Which of these is NOT a benefit of replication?
AHigh availability
BLoad balancing for reads
CData backup
DFaster writes on master
✗ Incorrect
Replication does not speed up writes on the master server.
In asynchronous replication, when does the master consider a transaction complete?
AImmediately after writing to binlog
BAfter slave confirms receipt
CAfter slave applies changes
DAfter backup completes
✗ Incorrect
The master does not wait for the slave in asynchronous replication.
What is the main role of the slave server in replication?
ATo send data changes to master
BTo backup the master server
CTo receive and apply changes from master
DTo manage user access
✗ Incorrect
The slave receives and applies changes sent by the master.
Explain how MySQL replication works between master and slave servers.
Think about the flow of data changes from one server to another.
You got /4 concepts.
List three practical reasons why database replication is important.
Consider what problems replication helps solve in real life.
You got /3 concepts.
Practice
(1/5)
1. What is the main purpose of MySQL replication?
easy
A. To copy data automatically from one database server to another
B. To create backups manually on the same server
C. To speed up SQL query execution on a single server
D. To encrypt data during transmission
Solution
Step 1: Understand replication concept
Replication means copying data from one database (called master) to another (called slave) automatically.
Step 2: Identify the main purpose
The main goal is to keep data synchronized between servers without manual copying.
Final Answer:
To copy data automatically from one database server to another -> Option A
Quick Check:
Replication = automatic data copy [OK]
Hint: Replication means automatic data copying between servers [OK]
Common Mistakes:
Confusing replication with backup
Thinking replication speeds up queries on one server
Assuming replication encrypts data
2. Which command is used to start replication on a MySQL slave server?
easy
A. START SLAVE
B. START REPLICATION
C. BEGIN SLAVE
D. RUN SLAVE
Solution
Step 1: Recall replication start command
In MySQL, the command to start the slave replication process is START SLAVE.
Step 2: Check other options
Other options like START REPLICATION, BEGIN SLAVE, or RUN SLAVE are not valid MySQL commands.
Final Answer:
START SLAVE -> Option A
Quick Check:
Start replication = START SLAVE [OK]
Hint: Use START SLAVE to begin replication on slave server [OK]
Common Mistakes:
Using incorrect commands like START REPLICATION
Confusing with transaction commands
Forgetting to start the slave after setup
3. Given the command CHANGE MASTER TO MASTER_HOST='192.168.1.10', MASTER_USER='replica', MASTER_PASSWORD='pass'; executed on a slave, what does it do?
medium
A. Deletes the current master configuration
B. Starts replication immediately with given credentials
C. Creates a new master server at 192.168.1.10
D. Sets the slave to connect to the master at IP 192.168.1.10 using user replica
Solution
Step 1: Understand CHANGE MASTER TO command
This command configures the slave server to connect to a master server with specified host and user credentials.
Step 2: Analyze given parameters
It sets the master host IP to 192.168.1.10 and uses the user 'replica' with password 'pass' for connection.
Final Answer:
Sets the slave to connect to the master at IP 192.168.1.10 using user replica -> Option D
Quick Check:
CHANGE MASTER TO = configure slave connection [OK]
Hint: CHANGE MASTER TO sets slave's master connection info [OK]
Common Mistakes:
Thinking it starts replication immediately
Assuming it creates a new master server
Believing it deletes master config
4. You run START SLAVE; but replication does not start. Which of these is a likely cause?
medium
A. The master server is down
B. The slave user password is empty
C. The slave has not been configured with CHANGE MASTER TO
D. The slave server is running MySQL version 8
Solution
Step 1: Check slave configuration
If the slave is not configured with CHANGE MASTER TO, it does not know which master to connect to.
Step 2: Understand replication start requirements
Without proper master info, START SLAVE cannot initiate replication, even if master is up or password is set.
Final Answer:
The slave has not been configured with CHANGE MASTER TO -> Option C
Quick Check:
Missing CHANGE MASTER TO blocks replication start [OK]
Hint: Configure slave with CHANGE MASTER TO before START SLAVE [OK]
Common Mistakes:
Assuming START SLAVE works without configuration
Blaming MySQL version without checking config
Ignoring master server status
5. You want to set up a slave that replicates only the database named sales. Which command helps you filter replication to this database?
hard
A. CHANGE MASTER TO MASTER_DB='sales';
B. CHANGE REPLICATION FILTER REPLICATE_DO_DB = ('sales');
C. SET REPLICATION FILTER TO 'sales';
D. CHANGE REPLICATION FILTER REPLICATE_DO_DB = 'sales';
Solution
Step 1: Understand replication filtering
MySQL uses replication filters like REPLICATE_DO_DB to replicate only specific databases.
Step 2: Identify correct syntax
The correct syntax uses CHANGE REPLICATION FILTER REPLICATE_DO_DB = ('sales'); with parentheses around the database name.
Final Answer:
CHANGE REPLICATION FILTER REPLICATE_DO_DB = ('sales'); -> Option B
Quick Check:
Use REPLICATE_DO_DB with parentheses for filtering [OK]
Hint: Use CHANGE REPLICATION FILTER with REPLICATE_DO_DB and parentheses [OK]
Common Mistakes:
Using non-existent commands like SET REPLICATION FILTER
Omitting parentheses around database name
Trying to filter with CHANGE MASTER TO
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.