MySQL error code 1298, Slave incorrect timezone.

Problem for MySQL error code 1298

This tutorial has the solution for MySQL Master and slave replication. An error was “MySQL error code 1298, Slave Unknown or incorrect timezone: ‘Asia/Calcutta’ on the query. Default database: ‘tastethelinux’. Query”. You can find the screenshot below for the following error.

MySQL error code: 1298 Slave Unknown or incorrect timezone.

So we have established the connection between Master and Slave in MySQL. Then the restore process started from the relay-log-files. Then after some time, we got an error “1298 Slave Unknown or incorrect timezone”.


Solution for MySQL error code 1298

We have used the below command to fix the mysql error and after that, we stopped and started the slave again.

# mysql_tzinfo_to_sql /usr/share/zoneinfo/| mysql -u root mysql -p

Put the password, then it starts to load the timezone into our MySQL database.

this command will load the timezone into the MySQL Database

Now let’s STOP and START the SLAVE in a MySQL shell.

mysql> STOP SLAVE; START SLAVE;

That’s worked for me, with no error in the log file of the MySQL slave server.


What is mysql_tzinfo_to_sql command and /usr/share/zoneinfo ?

mysql_tzinfo_to_sql is a program that loads the time zone tables into the database.

The file /usr/share/zoneinfo has timezone information for Asia, America, Australia, etc. . This is all stored in binary If you still find any issue then let us know in the comment section.


Conclusion

We have got the solution for the MySQL error. For that, we have checked the log files for the MySQL slave server. We found “error code 1298, Slave Unknown or incorrect timezone: ‘Asia/Calcutta’ on the query”. Solution for MySQL error code 1062 Slave Duplicate entry and 1594, Relay log read failure.

What steps do you have to follow after you changed the Master host, How to “reconnect with MySQL Master host“.

If you want to install Download and install MySQL 8 in Ubuntu then follow the link. We have a post on the Upgrade of the MySQL database. Any issues or feedback please let us know in the comment section.


Give your valuable time