Here is the proper way to start MySQL automatically on boot with a CentOS 5.x system:
sudo chkconfig mysqld on
If you get a 'command not found' error, your path does not include /sbin (which is where the chkconfig command lives). You will need to either add /sbin to your path, or run this command:
sudo /sbin/chkconfig mysqld on
To verify, run this command:
Search for the row named 'mysqld'. Check that the mysql service is on for runlevel 3 (you should see 3
n in this row).
As before, if /sbin is not in your path, simply run "/sbin/chkconfig --list".
You can set other services to start (or not to start) on boot. For example, to set Apache to start at boot:
sudo chkconfig httpd on
To automatically run the bash script on boot, vpswing's instructions are correct. Edit /etc/rc.local and add a line at the end pointing towards the script: