# Mysql Failover Script

**URL:** <https://forums.percona.com/t/mysql-failover-script/25496>\
**Category:** Uncategorized\
**Tags:** mysql\
**Created:** [September 27, 2023, 1:38pm UTC](https://forums.percona.com/t/mysql-failover-script/25496 "2023-09-27T13:38:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![parttime](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@parttime](https://forums.percona.com/u/parttime)\
**Post date:** [September 27, 2023, 1:38pm UTC](https://forums.percona.com/t/mysql-failover-script/25496/1 "2023-09-27T13:38:24Z")

</div>

Hi all,  
I have master-slave node’s. This node’s 5.7 Mysql version. I want to change master-slave node’s.  
How can ı this situation? Could you help me for this script.

Regards.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [September 27, 2023, 2:56pm UTC](https://forums.percona.com/t/mysql-failover-script/25496/2 "2023-09-27T14:56:24Z")

</div>

Hello @parttime,  
Can you explain that a bit more? I’m not sure I understand. You have a master-slave setup and you want to change, what exactly?

---

<div class="post-metadata">

**Author:** ![parttime](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@parttime](https://forums.percona.com/u/parttime)\
**Post date:** [October 11, 2023, 7:05pm UTC](https://forums.percona.com/t/mysql-failover-script/25496/3 "2023-10-11T19:05:24Z")

</div>

ı want to switcth from master to slave.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [October 12, 2023, 1:35am UTC](https://forums.percona.com/t/mysql-failover-script/25496/4 "2023-10-12T01:35:39Z")

</div>

There is no standard script for this. Switching master to slave is something you will have to create for yourself. The process goes like this:

1. Put mysql master into read-only mode
2. Stop application traffic
3. stop replication from master-\>slave
4. setup different replication from slave-\>master
5. point application to slave (now the new master)
6. start application

The application will now write to slave/new-master which will replicate to old-master

You could also configure master/master replication (also known as source/source) and you can flip between them whenever you like.
