Posts List

Repairing MySQL multi-master replication

We have 2 servers, server1 is the known good and server2 is the one that is out of synchronisation. Make sure nothing is actively querying server2. You can do this by turning on full query logging and tailing the log file for any queries. mysql> SHOW GLOBAL VARIABLES like 'general_log%' ; +------------------+-------------------------------+ | Variable_name | Value | +------------------+-------------------------------+ | general_log | OFF | | general_log_file | /var/lib/mysql/server2.log | +------------------+-------------------------------+ 2 rows in set (0.

Unprivileged standalone instance of MySQL

Small script to run a instance of mysql in my home directory using the binary provided by the OS. Maybe some day I will make it more usable but for the time being it suits my needs. #!/bin/bash MYSQL_HOME=$HOME MYSQL_USER=$USER MYSQL_PORT=13306 ACTION=$1 if [ $ACTION == 'init' ]; then echo "initalising new mysql installation at $MYSQL_HOME/var/lib/mysql" rm -rf $MYSQL_HOME/var/lib/mysql mkdir -p $MYSQL_HOME/var/lib/mysql $MYSQL_HOME/mysql/data $HOME/var/lib/mysql/tmp mysql_install_db --user=$MYSQL_USER --datadir=$MYSQL_HOME/var/lib/mysql/data/ cat < $HOME/.my.cnf [mysqld] user=$MYSQL_USER datadir=$MYSQL_HOME/var/lib/mysql/data log-error=mysqld.