Archive MySQL Data In Chunks Using Stored Procedure

In a DBA’s day to day activities, we are doing Archive operation on our transnational database servers to improve your queries and control the Disk space. The archive is a most expensive operation since its involved a huge number of Read and Write will be performed. So its mandatory to run the archive queries in chunks. The archive is depended on business use. Many of us need a copy of the data on an archive database to refer later. To perform the archive we can just simply run the delete query with the limit. But we need to run the query again and again until the matched rows count is 0. We can create a procedure to do this in a while loop. I have created one such procedure to archive many tables. 

Read More

MySQL GTID vs MariaDB GTID

MySQL supports three types for binlog format. For safer binlog based replication its recommended to use ROW based replication. But even though in some worst cases this leads to data inconsistency. Later MySQL came up with the concept of GTID (global transaction identifiers) which generates the unique binlog entries to avoid any data inconsistency. This feature supports in MySQL 5.6+. Percona MySQL Servers is also using the same structure of MySQL’s  GTID. But MariaDB GTID is bit different.

Read More

How To Convert MySQL Two Digit Year To Four Digit Year

How To Convert MySQL Two Digit Year To Four Digit Year

Today I was working with a small MySQL data set. The data provided by a CSV file and needed to load it into AWS RDS MySQL. Since the RDS does not support the Load data inline. So I have manually convert the CSV file to .sql file. But the problem statement is, in CSV the date time column had two digit year format and while converting into sql it considered the day part as year and automatically added 20  in the beginning. MySQL has makedate function , but it didn’t work for me. My entire data for the year 2018.

Read More

How To Change MySQL Default Data,Binlog,Error Log Directories

change mysql default data,binlog, error log directories

MySQL Change default directories

While reading this heading everybody things like, yeah its pretty old topic, we can get many articles by googling. But you know what sometimes well known things never work for us. This time it happened for me, my bad. I have done this many times. But most of us changed the default Data Directory only. Only a few of us thinking about change MySQL default data,binlog, error log directories.

Read More