Monday, December 10, 2012

MySQL 5.6

Replication

Note 1760
Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.

With the new 5.6, while doing a change master to, I received the message
Query OK, 0 rows affected, 2 warnings (0.04) sec

A quick show warnings revealed the above note which is a ER_INSECURE_CHANGE_MASTER.

It took some digging, but yes, it's possible to store replication information in a table (mysql.slave_master_info):

set global master_info_repository = 'TABLE';

This can be set in the option file as well, so it's persistent between start ups.    As soon as you do this the master.info file in the datadir is removed, and the mysql.slave_master_info is populated.  You don't have to go clean up anything.  This also can be done for relay_log_info_repository as well.

What's the best way? 

From Linux a strings slave_master_info.ibd will show the user and password and server.  Since master.info is stored in datadir and the slave_master_info.ibd table is stored unencrypted in datadir/mysql, I don't see how it's more secure.

When you backup the server using mysqldump, you can carry the replication information with the backup using the TABLE mode.  So that might be more convenient for some folks.

If you have two instances running, using the same datadir and are slaves, it also may make it more convenient, so you don't have to make each one have a custom filename  using the master-info-file option.
 
Nice feature, but not any more secure from what I can see.  Anyone?

ADDENDUM:
When you do a show slave status\G  you will see a row such as this if it stores the master information in a table.  If it is in a file it will provide the full path and file name. 

 Master_Info_File: mysql.slave_master_info