mysqld, also known as MySQL Server, is the main program that does most of the work in a MySQL installation. MySQL Server manages access to the MySQL data directory that contains databases and tables. The data directory is also the default location for other information such as log files and status files. When MySQL server starts, it listens for network connections from client programs and manages access to databases on behalf of those clients. The mysqld program has many options that can be specified at startup. For a complete list of options, run this command: shell> mysqld --verbose –help Command to start mysql shell> mysqld –user=mysql // (--console) MySQL Server also has a set of system variables that affect its operation as it runs. System variables can be set at server startup, and many of them can be changed at runtime to effect dynamic server reconfiguration. MySQL Server also has a set of status variables that provide information about its operation. You can monitor these status variables to access runtime performance characteristics.
mysqld_safe is the recommended way to start a mysqld server on Unix and NetWare. mysqld_safe adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log file. mysqld_safe reads all options from the [mysqld], [server], and [mysqld_safe] sections in option files. The mysqld_safe script is written so that it normally can start a server that was installed from either a source or a binary distribution of MySQL, even though these types of distributions typically install the server in slightly different locations. (See Section 2.7, “Installation Layouts”.) mysqld_safe expects one of the following conditions to be true: The server and databases can be found relative to the working directory (the directory from which mysqld_safe is invoked). For binary distributions, mysqld_safe looks under its working directory for bin and data directories. For source distributions, it looks for libexec and var directories. This condition should be met if you execute mysqld_safe from your MySQL installation directory (for example, /usr/local/mysql for a binary distribution). If the server and databases cannot be found relative to the working directory, mysqld_safe attempts to locate them by absolute path names. Typical locations are /usr/local/libexec and /usr/local/var. The actual locations are determined from the values configured into the distribution at the time it was built. They should be correct if MySQL is installed in the location specified at configuration time. --basedir=path The path to the MySQL installation directory. --help Display a help message and exit --defaults-extra-file=path The name of an option file to be read in addition to the usual option files. --log-error=file_name Write the error log to the given file --ledir=path If mysqld_safe cannot find the server, use this option to indicate the path name to the directory where the server is located --no-defaults Do not read any option files. This must be the first option on the command line if it is used. --defaults-file=file_name The name of an option file to be read instead of the usual option files. This must be the first option on the command line if it is used. --mysqld-version=suffix This option is similar to the --mysqld option, but you specify only the suffix for the server program name. The basename is assumed to be mysqld. For example, if you use --mysqld- version=debug, mysqld_safe starts the mysqld-debug program in the ledir directory. If the argument to --mysqld-version is empty,mysqld_safe uses mysqld in the ledir directory. --open-files-limit=count The number of files that mysqld should be able to open. The option value is passed to ulimit -n. Note that you need to start mysqld_safe as root for this to work properly! --pid-file=file_name The path name of the process ID file. --port=port_num The port number that the server should use when listening for TCP/IP connections. The port number must be 1024 or higher unless the server is started by the root system user. --socket=path The Unix socket file that the server should use when listening for local connections.
4.3. mysql.server — MySQL Server Startup Script MySQL distributions on Unix include a script named mysql.server . It can be used on systems such as Linux and Solaris that use System V-style run directories to start and stop system services. It is also used by the Mac OS X Startup Item for MySQL. mysql.server can be found in the support-files directory under your MySQL installation directory or in a MySQL source distribution. --basedir=path The path to the MySQL installation directory. --datadir=path The path to the MySQL data directory. --pid-file=file_name The path name of the file in which the server should write its process ID. --service-startup-timeout=file_name How long in seconds to wait for confirmation of server startup. If the server does not start within this time, mysql.server exits with an error. The default value is 900. A value of 0 means not to wait at all for startup. Negative values mean to wait forever (no timeout). This option was added in MySQL 5.1.17. Before that, a value of 900 is always used. --use-mysqld_safe Use mysqld_safe to start the server. This is the default. --user=user_name The login user name to use for running mysqld.
4.4. mysqld_multi ― Manage Multiple MySQL Servers
Check Out Our Related Courses
You liked the article?
Like : 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.
Get stories of change makers and innovators from the startup ecosystem in your inbox