mySQL / MariaDB - Display master status using the show master status command

by
Jeremy Canfield |
Updated: July 27 2022
| mySQL / MariaDB articles
There are two types of replication.
- Master-Master - Both databases are masters, meaning both can be used for reading and writing.
- Master-Slave - One database is the master, the other is the slave. Only the master can read and write, the slave can only read.
The show master status command can be used to display the status of the master. This assume you are able to log into your MariaDB or mySQL server or you have configured passwordless authentication and will be using the -e command line option.
~] mysql -e "show master status \G"
File: binary-log.000015
Position: 725
Binlog_Do_DB:
Binlog_Ignore_DB:
Notice in this example that the name of the binary log file is binary-log.000015. The name and location of the binary log files is defined using the log-bin directive in the main configuration file (e.g. /etc/my.cnf).
log-bin=/var/lib/mysql/binary-log
In this example, and by default, the binary log files are located in the /var/lib/mysql directory (on a Linux system).
~]# ll /var/lib/mysql
-rw-r----- 1 mysql mysql 70268749 Jul 24 20:47 binary-log.000014
-rw-r----- 1 mysql mysql 401992544 Jul 27 04:21 binary-log.000015
-rw-r----- 1 mysql mysql 66 Jul 24 20:47 binary-log.index
Did you find this article helpful?
If so, consider buying me a coffee over at