MySql

Rotating MySQL slow query log

PDF

On MySQL servers with slow query log enabled the log file might grow excessively when having a high volume of slow queries, the same might happen with the general mysql log file.
Simply deleting the log file might cause downtime while it might take a long time to perform the deletion of the log file (depends on the log file size and filesystem)
There is safeway way to rotate the slow query log files without stopping the mysqld daemon or blocking MySql during a truncate.

Tags:
 

MySQL master master replication

PDF

MySQL master-master replication (or multi master replication) offers a high availability failover solution. Other then in a master-slave replication setup you can write to all member master servers. Every master server is also a slave at the same time. Although all master server can write I would suggest to use only one active master server for writes and the other master be a passive master for reads and become active if the other server fails. With some monitoring scripts the passive master can become active within a fraction of a second.

 

DNS lookups slows down MySql

PDF
Access to a MySql database is granted based on username in combination with the hostname and a password. MySql will first try to lookup the hostname in the cache, if not found it tries to resolve the hostname. DNS resolution might become a performance issue. MySql will do a double reverse-DNS lookup, it will first lookup the hostname which belongs to the incoming ip-address, then it will lookup the ip-address belonging to the hostname and matches the incoming ip-address with the found ip-address by the DNS resolution. This all might work well, but it all relies on a good DNS infrastructure. Now what if the DNS server can not be reached? or the reverse DNS mappings do not match? In that case users might not be able to connect to the MySql server. To prevent this you should edit your MySql configuration and set skip_name_resolve in /etc/my.cnf If you already have your MySql server running you should convert the hostnames in the users table before restarting the mysqld daemon. Run the query:
 

How to set-up MySql replication

PDF

There are a number of different methods for setting up replication, and the exact method that you use will depend on how you are setting up replication, and whether you already have data within your master database.

Create a user for replication

The slaves need to connect to the master using an account granted ‘REPLICATION SLAVE’. As the username and password is stored in a plain-text file it is advisable to create a user that only has privileges for the replication.

Tags:
 

How to recover from a lost MySql root password

PDF

If you somehow lost the MySql root password it is possible to recover in just a few steps.

First stop the running MySql daemon process:

Tags:
 

Search






You are here: Home Howtos and FAQs MySql