Home > Database > Mysql Tutorial > Detailed explanation of mysql diagnosis startup problems and viewing log files

Detailed explanation of mysql diagnosis startup problems and viewing log files

巴扎黑
Release: 2017-05-20 14:08:12
Original
2130 people have browsed it

Diagnosing startup problems

Server startup problems usually occur when changes are made to the MySQL configuration or the server itself. MySQL reports errors when this problem occurs, but since most MySQL servers are started automatically as a system process or service, these messages may not be visible.

When troubleshooting system startup problems, you should first try to start the server manually. The MySQL server itself is started by executing mysqld on the command line. The following are several important mysqld command line options:

1.--help displays help - a list of options;

2.--safe-mode loads minus some of the best Configured server;

3.--verbose displays full-text messages (use with --help for more detailed help messages);

4.--version displays version information and then quit.

Several additional command line options (relevant to the use of log files) are listed in the next section.

View log files

MySQL maintains a series of log files that administrators rely on. The main log files are as follows.

1. Error log. It contains details of startup and shutdown problems and any critical errors. This log is typically named hostname.err and is located in the data directory. This log name can be changed with the --log-error command line option.

2. Query log. It logs all MySQL activity and is very useful when diagnosing problems. This log file can become very large very quickly, so it should not be used for long periods of time. This log is usually named hostname.log and is located in the data directory. This name can be changed with the --log command line option.

3. Binary log. It records all statements that have updated data (or may have updated data). This log is usually named hostname-bin and is located in the data directory. This name can be changed with the --log-bin command line option. Note that this log file was added in MySQL5, and previous MySQL versions used update logs.

4. Slow query log. As the name suggests, this log records any query that performs slowly. This log is useful in determining where the database needs optimization. This log is usually named hostname-slow.log and is located in the data directory. This name can be changed with the --log-slow-queries command line option.

When using logs, you can use the FLUSH LOGS statement to refresh and restart all log files.

【Related recommendations】

Mysql free video tutorial

2. Detailed explanation of backup and maintenance of MySQL database

3. Detailed explanation of MySQL setting access permission examples

4. MySQL creates user accounts and deletes user accounts

5. Command line example operation of mysql management user and password change

The above is the detailed content of Detailed explanation of mysql diagnosis startup problems and viewing log files. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template