Archive for the ‘Intermediate’ Category

Scenario: Master-Master replication Description: Master A is the active db server whilst Master B is a read only swappable db server hence both are creating binary logs. During backup I run “FLUSH LOGS” in order to have a simpler point in time recovery procedure if that case arises. Problem: Flush logs is mean mean command [...]

Sometimes we have some special need for a stored procedure to call another to do something. That is fine, but what if the second stored proc failed for some reason? Maybe you want to halt the first stored procedure (the caller) and not proceed with the work until the problem is verified and resolved. So [...]

Are you doing some datetime manipulation or maybe you are migrating from some database technology to MySQL or possibly using milliseconds? Here is an example on how to go about it: Say you have the following date: MAR 16 2008 09:12:51:893AM SELECT DATE_FORMAT(STR_TO_DATE(‘MAR 16 2008 09:12:51:893AM’,'%M %d %Y %h:%i:%s:%f%p’),’%Y%m%d%k%i%s.%f’); –> 2008031691251.893000 What if its PM [...]

If you have multiple database servers with strange names, or if you have to hop over multiple machines to connect to any mysql database server, then you know what a pain it can be to administer such a setup. Thanks to some scripting, you can automate such tasks as follows: Create an expect script: /path/to/sshmysql.exp [...]