Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
public:mysql [2022/07/19 23:44] – [database(s) backup] row lock speech Nicopublic:mysql [2026/04/05 11:06] (current) – [duplicate entry in replication] cosmetic fixes Nico
Line 121: Line 121:
 fi fi
 </code> </code>
 +
 ==== slave setup ==== ==== slave setup ====
   * copy and extract database backup on the slave   * copy and extract database backup on the slave
Line 129: Line 130:
 report-host = slave_name  report-host = slave_name 
 </code> </code>
 +
   * unpack the snapshot   * unpack the snapshot
   * Execute the following statement on the slave    * Execute the following statement on the slave 
Line 139: Line 141:
     ->     MASTER_LOG_POS=recorded_log_position;     ->     MASTER_LOG_POS=recorded_log_position;
 </code> </code>
 +
   * Execute START SLAVE on the slave.   * Execute START SLAVE on the slave.
  
Line 147: Line 150:
  
  If MySQLTuner reports fragmented tables, you can check them all with:  If MySQLTuner reports fragmented tables, you can check them all with:
-<code>+ 
 +<code bash>
 mysqlcheck -o --all-databases mysqlcheck -o --all-databases
 </code> </code>
 +
 ===== troubleshooting ===== ===== troubleshooting =====
  
Line 156: Line 161:
  
   * stop slave   * stop slave
-<code sql>+ 
 +```sql
 mysql> STOP SLAVE; mysql> STOP SLAVE;
-</code>+``` 
   * either manually delete the duplicate entry, or skip counter by issuing:   * either manually delete the duplicate entry, or skip counter by issuing:
-<code sql>+ 
 +```sql
 mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
-</code>+``` 
   * start slave   * start slave
-<code sql>+ 
 +```sql
 mysql> START SLAVE; mysql> START SLAVE;
-</code>+```
  
 ==== rebuild database indexes ==== ==== rebuild database indexes ====
-<code> +<code bash
-  # mysqlcheck -p -r -q -q <table>+# mysqlcheck -p -r -q -q <table>
 </code> </code>
  
Line 177: Line 187:
  
   * start MySQL without authentification   * start MySQL without authentification
-<code>+ 
 +<code bash>
 # /usr/local/libexec/mysqld -u mysql --skip-grant # /usr/local/libexec/mysqld -u mysql --skip-grant
 </code> </code>
 +
   * connect to MySQL and change password   * connect to MySQL and change password
 +
 <code sql> <code sql>
 # mysql # mysql