Slave replication stops with Last_SQL_Errno: 1032

You can locate the sql clause code like /usr/bin/mysqlbinlog -v –start-position=142743807 –stop-position=147399325 /data/mysql/data/master-bin.000010 > temp.log Then compare slave and master database difference according to temp.log on specific pos. Then update slave database. Then skip that line with mysql -e “stop slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; start slave;”;

Slave_SQL_Running: No: MySQL replication stopped working

TL;DR STOP SLAVE; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; START SLAVE; Now the slightly longer version: if you have manually created the user on your slave first and on your master second, the CREATE USER command executed on the master has been replicated to the slave. Attempted subsequent execution of the statement failed, because the user … Read more

What causes the MySQL error 1062 – duplicate entry when starting slave?

What to try to fix your problem: You should remove master.info on slave first and restart mysql issue CHANGE MASTER TO MASTER_HOST=’XX.XX.XX.XX’, MASTER_USER=’repl’, MASTER_PASSWORD=’slavepass’; do mysqldump with ‘–flush-logs’ option on master ‘mysql -u user -p < dump.sql’ on slave ‘show slave status\G’ on slave to ensure that it is properly configured, MASTER_LOG_POS is 0 ‘start … Read more

How to setup MySQL replication with minimal downtime

I assume you use InnoDB as a storage engine. If so, you need to turn on bin-logging. If it’s not on now, you need to restart MySQL after modifying my.cnf. It is the only downtime, after which you can take dump of the database with binlog position without blocking the database: mysqldump –skip-lock-tables –single-transaction –flush-logs … Read more

Is it ok to replicate the `mysql` database?

It is entirely possible to give yourself mysql permissions without knowing SQL GRANT commands. Example : Here is to create your own user with full privileges using SQL GRANT from anywhere called superdba with a password of ClarkKent: GRANT ALL PRIVILEGES ON *.* TO superdba@’%’ IDENTIFIED BY ‘ClarkKent’ WITH GRANT OPTION; Here is how you … Read more

How can I export the privileges from MySQL and then import to a new server?

Do not mess with the mysql db. There is a lot more going on there than just the users table. Your best bet is the “SHOW GRANTS FOR” command. I have a lot of CLI maintenance aliases and functions in my .bashrc (actually my .bash_aliases that I source in my .bashrc). This function: mygrants() { … Read more