User Tools

Site Tools


useful:mysql-mariadb

This is an old revision of the document!


Contents Page

MySQL / MariaDB

Resync replication

This deserves a page to itself.

Log all queries

To change in the current running server:

   SET GLOBAL log_output = 'FILE';
   SET GLOBAL general_log_file = '/var/log/mysql/general.log';
   SET GLOBAL general_log = 'ON';
   

Try to move past replication error

This assumes that replication was previously working.

It is easy for replication to be upset slightly, resulting in an error on the slave that stops it operating. It then gets behind the master and manual intervention is needed.

Sometimes more substantial intervention is needed, but often bypassing the error is all that is needed. Before you start, check the situation by going into a MySQL client and entering:

  show slave status\G

Look at the error to see whether it is the sort of thing that can reasonably be ignored on a slave. If so, in a MySQL client enter the following statements:

  stop slave;
  set global sql_slave_skip_counter = 1;
  start slave;
  show slave status\G

Or, combine the first three on a single line:

  stop slave; set global sql_slave_skip_counter = 1; start slave;
  

It's best to pause before checking slave status, as failures may soon reoccur.

Check whether the slave is now running. Sometimes this has to be repeated – checking each time that the error can be ignored. Often this will get replication working again and the slave will catch up with the master.

MySQL blocks access to data in /home directories

This may be blocked by the MariaDB service. To fix correctly override the service file with a local copy:

  sudo cp /lib/systemd/system/mariadb.service /etc/systemd/system

Edit /etc/systemd/system/mariadb.service and change ProtectHome to be false (ProtectHome=false). Save the file, then:

  sudo systemd daemon-reload # refresh the systemd services so it sees your override file
  sudo systemctl start mysql # and it should finally start
useful/mysql-mariadb.1660372763.txt.gz · Last modified: 2022/08/13 06:39 by admin