Automatically Purge MySQL Master Log

Thursday, September 9th, 2010

My Friend Andre Hartawan is troubling due to his mysql server at work stop operating. After quick check he found that no more disk space available on the system. Further check on /var partition he found many replication log file on disk which no longer needed but have big size (100MB). He can easily purge the logs file but wanted the server due it chores automatically. So here it’s I share my script (autopurgebinlog.sh) to purge replication logbin automatically.
(more…)

SocialTwist Tell-a-Friend

MySQL partition is full

Saturday, September 5th, 2009

MySQL databases are located on /var/lib/mysql, if you create a partition for /var and and big enough to hold your databases MySQL will stop working because not enough space to put the data. Below is the easy way to fix it:
(more…)

SocialTwist Tell-a-Friend

Replacing A Failed Hard Drive In A Software RAID1 Array

Tuesday, June 23rd, 2009

I was checking Development MySQL server (what did you know, I am not that lazy) and I found errors at /var/log/messages, I assume the secondary HDD (/dev/hdb) failed. Fiuh, I am lucky configured this server using Software-Raid1 otherwise all data has gone.

Jun 19 15:51:56 dbdemo smartd[2117]: Device: /dev/hdb, 37997 Currently unreadable (pending) sectors
Jun 19 15:51:56 dbdemo smartd[2117]: Device: /dev/hdb, 37997 Offline uncorrectable sectors
Jun 19 16:21:57 dbdemo smartd[2117]: Device: /dev/hdb, 38010 Currently unreadable (pending) sectors
Jun 19 16:21:57 dbdemo smartd[2117]: Device: /dev/hdb, 38010 Offline uncorrectable sectors
Jun 19 16:23:47 dbdemo kernel: hdb: task_in_intr: status=0x59 { DriveReady SeekComplete DataRequest Error }

Luckily, uncle Google very nice to me and show me article on Howtoforge.com, following the article I am confident to replace failed harddisk. Below is my Raid configuration:

Array: /dev/md0; Member: /dev/hda1 /dev/hdb1; Raid: 1; Filesystem: ext3fs; mountpoint: /boot
Array: /dev/md1; Member: /dev/hda2 /dev/hdb2; Raid: 0; Filesystem: swap; mountpoint: swap
Array: /dev/md2; Member: /dev/hda3 /dev/hdb3; Raid: 1; Filesystem: ext3fs; mountpoint: /

Summary of Howtoforge’s article is below:

(more…)

SocialTwist Tell-a-Friend

SQL Error: Table ‘mysql.proc’ doesn’t exist

Thursday, June 18th, 2009

Today I upgraded my HeidiSQL into version 4, but when I am running it on the MySQL server 5.0 I got error

"SQL Error: Table 'mysql.proc' doesn't exist"

After googling around, found that this error caused HeidiSQL requires table Mysql.proc which is not exist. Table Mysql.proc is used to store procedure. But wait, I am using MySQL 5.0.x which already support Procedures and Views!! so How come this error show up??

After some tought, the are several reason why this error came up although you are using MySQL 5.

  1. You are upgrading from MySQL 4.x
  2. Your MySQL 5.x installation didn’t smooth

And in my case, it was reason no. 1, as I am remember I was once upgrade mysql server a year ago. So how to fix it? (more…)

SocialTwist Tell-a-Friend

Script to Monitor Replication

Monday, February 9th, 2009

Since I sometimes get replication problem, so I make several script to check replication automatically and report to me:

To check replication status when I in the console and playing with replication configuration or when I have nothing to do yet I want to see a black screen :D

monitorreplication.sh

#!/bin/bash
while [ 1 ]
do
        # Your code goes here
        echo ""
        date
        echo "=============================="
        mysql -u backup -pmysqlback -e "show slave status\G;"

        # Modify sleep time (in seconds) as needed below
        sleep 10
done

Another scripts to send replication status via email
(more…)

SocialTwist Tell-a-Friend