# Default values for MASTER\_LOG\_POS in CHANGE MASTER TO statement

**URL:** <https://forums.percona.com/t/default-values-for-master-log-pos-in-change-master-to-statement/7721>\
**Category:** Percona Server for MySQL 5.6\
**Created:** [June 26, 2020, 10:23am UTC](https://forums.percona.com/t/default-values-for-master-log-pos-in-change-master-to-statement/7721 "2020-06-26T10:23:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisCard](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/chriscard/32/2492_2.png) [@ChrisCard](https://forums.percona.com/u/ChrisCard)\
**Post date:** [June 26, 2020, 10:23am UTC](https://forums.percona.com/t/default-values-for-master-log-pos-in-change-master-to-statement/7721/1 "2020-06-26T10:23:27Z")

</div>

we have a Perl script which we use to perform failover of a slave to become a master, and I am trying to ensure it works with Percona Server 5.6.   
Part of the processing in the script involves calling “CHANGE MASTER TO …” on all the other slaves, to get replication going to them from the new master.  
The script is quite old and has a section which decides on the value to use for MASTER\_LOG\_POS in the CHANGE MASTER TO statement, based on the version of MySQL running on the new master.   
It has the following values defined for different versions of MySQL : 4.1 =\> 79, 5.1 =\> 106, 5.5 =\> 107 and 5.7 =\> 123, but I don’t know what value to use for 5.6 and I can’t find any MySQL documentation that tells me why these values have been chosen.  
Can anyone help me with this?  
Chris

---

<div class="post-metadata">

**Author:** ![vaibhav\_upadhyay40](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vaibhav_upadhyay40/32/9_2.png) [@vaibhav\_upadhyay40](https://forums.percona.com/u/vaibhav_upadhyay40)\
**Post date:** [June 26, 2020, 11:53am UTC](https://forums.percona.com/t/default-values-for-master-log-pos-in-change-master-to-statement/7721/2 "2020-06-26T11:53:46Z")

</div>

Hi @ChrisCard   
Basically **master\_log\_pos** is the position from which slave should start reading the master binary logs.  
Any values defined in documentation is usually for understanding and for example. It doesn’t suggest to use in real-time scenario.   
coming to the which position to specify, it depends at which point the fail-over happened and at that point what is the sync status and binlog position on slave.&nbsp;  
  
Hope i have got your question right, hope this helps.

---

<div class="post-metadata">

**Author:** ![ChrisCard](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/chriscard/32/2492_2.png) [@ChrisCard](https://forums.percona.com/u/ChrisCard)\
**Post date:** [June 27, 2020, 2:48am UTC](https://forums.percona.com/t/default-values-for-master-log-pos-in-change-master-to-statement/7721/3 "2020-06-27T02:48:17Z")

</div>

Hi @vaibhav_upadhyay40   
Thanks for you reply.  
I understand what master\_log\_pos is, but your answer has made be realise that I missed an important point, which is that before calling “CHANGE MASTER TO” on the slaves, the script calls “RESET MASTER” on the new master. So these “magic numbers” are what to set master\_log\_pos to in that situation for different MySQL&nbsp; versions, I assume because the format of the binary logs change slightly on each release. What I need is the “magic number” for Percona 5.6.  
Chris  
UPDATE: some experimentation appears to show that the number is 120 for Percona 5.6, but I’d like some firmer confirmation.

---

<div class="post-metadata">

**Author:** ![vaibhav\_upadhyay40](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vaibhav_upadhyay40/32/9_2.png) [@vaibhav\_upadhyay40](https://forums.percona.com/u/vaibhav_upadhyay40)\
**Post date:** [June 27, 2020, 7:54am UTC](https://forums.percona.com/t/default-values-for-master-log-pos-in-change-master-to-statement/7721/4 "2020-06-27T07:54:06Z")

</div>

Yes you are right its 120.  
basically the logs position in the prompt will show position # 120 by default, however binary logs internally starts at position #4.  
so i think, this is the magic no/position you are referring to (position no. 4). i am assuming this is what you are looking for.&nbsp;  
You can use below command to read and check the binarylog position.&nbsp;  
_shell\> mysqlbinlog /var/lib/mysql/master-bin.000xxxx --base64-output=DECODE-ROWS \> test.txt_Hope this helps.

---

<div class="post-metadata">

**Author:** ![ChrisCard](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/chriscard/32/2492_2.png) [@ChrisCard](https://forums.percona.com/u/ChrisCard)\
**Post date:** [June 29, 2020, 2:27am UTC](https://forums.percona.com/t/default-values-for-master-log-pos-in-change-master-to-statement/7721/5 "2020-06-29T02:27:47Z")

</div>

Thanks for the confirmation. Is the fact that the default master\_log\_pos is 120 for Percona Server 5.6 documented anywhere?

---

<div class="post-metadata">

**Author:** ![vaibhav\_upadhyay40](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vaibhav_upadhyay40/32/9_2.png) [@vaibhav\_upadhyay40](https://forums.percona.com/u/vaibhav_upadhyay40)\
**Post date:** [July 1, 2020, 4:50pm UTC](https://forums.percona.com/t/default-values-for-master-log-pos-in-change-master-to-statement/7721/6 "2020-07-01T16:50:20Z")

</div>

sorry @ChrisCard i have no information on this.
