This page looks best with JavaScript enabled

Get MySQL replication information from a slave.

 ·  🎃 kr0m

In previous articles, it was explained how to set up a MySQL master/slave using Xtrabackup and traditional dump . In both cases, we needed a replication user and a password. Sometimes, we do not record this information, which can be problematic if we need to connect a new slave.

Fortunately, if we have a previously connected slave, we can retrieve this information.

mysql -sre "SELECT * FROM mysql.slave_master_info\G;"
*************************** 1. row ***************************
       Number_of_lines: 25
       Master_log_name: mysql-bin.000160
        Master_log_pos: 1046720727
                  Host: testkr0m-mysql01.alfaexploit.com
             User_name: rep_user
         User_password: REP_USER_PASSWORD
                  Port: 3306
         Connect_retry: 60
           Enabled_ssl: 0
                Ssl_ca:
            Ssl_capath:
              Ssl_cert:
            Ssl_cipher:
               Ssl_key:
Ssl_verify_server_cert: 0
             Heartbeat: 30
                  Bind:
    Ignored_server_ids: 0
                  Uuid: 022c38e3-c1a1-11ee-9684-00123ee6rafa
           Retry_count: 86400
               Ssl_crl:
           Ssl_crlpath:
 Enabled_auto_position: 1
          Channel_name:
           Tls_version:

The information we are interested in is:

             User_name: rep_user
         User_password: REP_USER_PASSWORD
If you liked the article, you can treat me to a RedBull here