mysqld_safe - MySQL Server Startup Script


What is mysqld_safe

The mysqld_safe command is considered as the right way to start a mysqld server on Unix.

  • It adds certain safety features like restarting the server when an error occurs and logging runtime information to an error log.

  • It tries to start an executable named mysqld. To override this default behavior and specify the name of the server explicitly, which is the one that the user wants to run, a --mysqld or -- mysqld-version option can be specified to mysqld_safe. The --ledir can also be used to tell the directory where mysqld_safe should look for the server.

  • Options unknown to mysqld_safe are passed to mysqld only if they are specified on the command line. They are ignored if they are specified in the [mysqld_safe] group of an option file.

  • It reads all options from the [mysqld], [server], and [mysqld_safe] sections in option files.

  • For backward compatibility, mysqld_safe reads [safe_mysqld] sections, but to be current the user should rename such sections to [mysqld_safe].

  • mysqld_safe accepts options on the command line and in option files,

To start or stop the server manually with the help of mysql.server script, invoke it from the command line with start or stop arguments. It is shown below −

shell> mysql.server start
shell> mysql.server stop

To use a specific tcmalloc library, its full path name needs to be specified. Let us seen an example −

[mysqld_safe]
malloc-lib=/opt/lib/libtcmalloc_minimal.so

Updated on: 10-Mar-2021

538 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements