{
"$type": "site.standard.document",
"canonicalUrl": "https://rickymoorhouse.uk/blog/2010/2010-09-06-recover-from-failed-to-open-the-relay-log",
"path": "/blog/2010/2010-09-06-recover-from-failed-to-open-the-relay-log",
"publishedAt": "2010-09-06T14:17:12.000Z",
"site": "at://did:plc:r53zv4vpzeihop3aliwyejlu/site.standard.publication/3mos5q3a7jf2w",
"tags": [
"MySQL",
"tech"
],
"textContent": "If you find that after rebooting your MySQL slave it stops replicating with the master and you see the \"Failed to open the relay log\" error in the logs it is probably caused by MySQL putting it's relay logs in /var/run by default, which gets cleared out on boot.\n\nTo fix this, you need to change the location MySQL uses for the logging by adding the following line to the [mysqld] section of /etc/my.cnf\n\nrelay-log = /var/lib/mysql/relay-bin\n\nThen edit /var/lib/mysql/relay-log.info to point to the first new relay log (leaving the master information the same.\n\n/var/lib/mysql/relay-bin.000001 \n1 \nmysql-bin.12345 \n123456789\n\nThen from the mysql prompt start the slave:\n\nmysql> START SLAVE;\n\n(Source: Arjen's Journal)",
"title": "Recover from \"Failed to open the relay log\""
}