Sunday, January 24, 2016

Special Note on mysqld_safe — MySQL Server Startup Script

When it happens to work on mysql databases, it is common to use mysqld_safe script. However, there are most important points which hidden behind the sense. Sometimes as mysql administrators, implementation engineers, system engineers might be missing that one.

More or less, this page would be familer to people who deal with mysql. Reference is mentioned here in case to have a deeper look and complete reading (http://dev.mysql.com/doc/refman/5.7/en/mysqld-safe.html).


For better understanding, here there are two snippets took from mysqld_safe script comments itself and mysql documentation mysqld_safe section. Still if reader would be wondering what is the point this guy going to make better go through simple wording in that snippets. 

Snippet taken from mysqld_safe script comment

 Snippet taken from mysql documentation mysqld_safe


Does that make sense when reading that? Most probably, it is noticed mysqld_safe script looks for at least one condition to be met to execute. Which is special that other start up script if you happen to work with apache HTTPD, apache Tomcat, WebLogic, and IBM WebSphere servers. In simple terms no matter what when executing mysqld_safe script. Current working directory must be mysql_installation_directory. Things would become worse, when using customized installation location. For instance, most of the time product based companies tend to install mysql as their preferred locations. What if that this fact is not aware to you who is going to implement mysql sever. In normal run, startup script comes with mysql binary installation works perfectly since that mysql.server script keeps that rule not violating.

Trust me, real instance occurred on setting up CentOS 7 cluster with mysql service for my first time. Because mysql resource doesn’t start up throwing below error many times. It doesn’t give clue to start troubleshooting. Oh such a pain again.

Issue on CentOS7 cluster mysql resource agent.

I’m pretty sure that mysql installation perfectly okey. It would be able to start/stop/login using init.d script without CentOS7 cluster.

Having hours sitting in front of my notebook trying to dig deeper resource agent script why this thing is throwing. Finally, it is figured out that simplest condition for mysqld_safe is not catered in mysql resource agent script.Having simple cd mysql_installation_directory works with out issue. 

Caution: If you happened to use mysqld_safe inside any script. Make sure you change directory to mysql installation location. Or follow the guide lines given in mysql documentation if it failed when running script from mysql installation location.

Solution.


No comments:

Post a Comment