2009
08.16

Mysql Innodb configuration

By Satish Natarajan

If you want all the tables to be InnoDB add this line to  your /etc/my.cnf file

‘default-storage-engine=innodb’

2009
08.16

How to sync up time on your LINUX machines?

By Satish Natarajan

  • Make sure you install ntp package. on fedora or centos ‘yum install ntp’
  • /usr/sbin/ntpdate -b -u <YOUR NEAREST NTP SERVER>  I use ntp1.sf-bay.org
  • If you want to sync up every 3 hrs (I like to)
  • Run ‘crontab -e’ and add this line ‘0 */3 * * * /usr/sbin/ntpdate -b -u ntp1.sf-bay.org >/dev/null 2>&1′

HAPPY SYNC’ ing.

NOTE: Very important if you do Rsync or db replication – you will save yourself lot of heartache ;-)

2009
08.16

mysql_install_db Always use the –user option

By Satish Natarajan

Well if you are like most of the system admins – you would want to run your db as it is own user. If you are one of the folks who was forced to run the mysql_install_db script, please please user the –user mysql ( I am assuming you will be using mysql as the user name).

If you do not use it and ran it already do this ‘chown -R mysql.mysql /var/lib/mysql’

2009
08.16

Setting up big INNODB database – Wait … Patience

By Satish Natarajan

I just ran into this issue where one of our customers was setting up a fresh innodb engine database whose ibdata file was 2 GB.

The startup script when run the first time will try to create the database. The setup script will time out because it takes a long time. BUT WAIT….

if you run the command ‘ps -ef | grep mysql’  OR ‘top’ – you will mysqld_safe is still working hard.

After 10 mins or so connect using ‘mysql -u root -p<password>’ if it does not connect come back after 10 mins. You can also see the file size of ibdata files in /var/lib/mysql for clues.

Check engine status using the mysql command ’show engines’ – you will now see the innodb working.

Now to cleanly shutdown the system – DO NOT KILL the mysqld_safe. Instead use ‘mysqladmin shutdown’.

From then onwards you can use ‘/etc/init.d/mysqld start’ — YOU HAVE A GOOD DB!

2009
08.16

How to check database table engine status

By Satish Natarajan

show table status from <database-name>

2009
08.16

How to check the status of db engines in MySQL

By Satish Natarajan

show engines;