Thursday, September 1, 2011

MySQL: install as deamon, for start/stop at system startup/shutdown (under CentOS 5.6 64 bit)

Go under mysql execution commands directory....:
cd /usr/bin/
Create startupMysql.sh file with the follow code:
#!/bin/bash
/etc/init.d/mysqld start
Create shutdownMysql.sh file with the follow code:
#!/bin/bash
/etc/init.d/mysqld stop
Give to them the execution privileges only for root
chmod 700 startupMysql.sh
chmod 700 shutdownMysql.sh
Choose the your "favourite" rcXXX.d directory (depends to your configuration)
to put into your deamon startup/shutdown commands.
I choose rc5.d, so:
cd /etc/rc5.d
and give the following ln -s commands:
ln -s /usr/bin/startup_mysqld.sh S100startupMysql
ln -s /usr/bin/shutdown_mysqld.sh K100shutdownMysql
Your deamon startup/shutdown commands are done well...
Now clean up the mysql log file(you find it into /etc/my.cnf), usually /var/log/mysqld.log
cd /var/log
echo "" > mysqld.log
to check, if at the system restart, you mysql restart too.
Restart the system.....:
shutdown -r now

Byw


No comments:

Post a Comment