Record once configure mariadb slow query log, MARIADB cannot be restarted

Source: Internet
Author: User
Tags prepare

Configure mariadb slow query log Be sure to configure the full path (including file name) Otherwise you cannot restart mariadb (/usr/local/mysql/data/slow.log) The file path for the configuration mariadb Log audit can be without a filename, but this is not possible.

10:22:29 system Mariadb-prepare-db-dir:database mariadb is probably initialized In/var/lib/mysql already
is done. 10:22:29 system Mariadb-prepare-db-dir:if This isn't the case, make sure The/var/lib/mysql is empty before ng Mariadb-prepare-db-dir 10:22:29 system mysqld_safe:180128 10:22:29 mysqld_safe Logging to '/var/log/mariadb/ma
Riadb.log '.
10:22:29 system mysqld_safe:180128 10:22:29 Mysqld_safe starting mysqld daemon with databases From/var/lib/mysql 10:27:29 system Systemd:mariadb.service start-post operation timed out.
stopping.
10:30:01 System systemd:started Session 9063 of user root.
10:30:01 System systemd:starting Session 9063 of user root. 10:32:29 system Systemd:mariadb.service stop-sigterm timed out.
Killing. 10:32:29 system Systemd:mariadb.service:main Process exited, code=killed, status=9/kill the 10:32:29 system sy
stemd:failed to start MARIADB database server. 28 10:32:2.9 System Systemd:unit Mariadb.service entered failed state.
10:32:29 system Systemd:mariadb.service failed.
10:37:04 system systemd:starting MARIADB database server ...  10:37:04 system Mariadb-prepare-db-dir:database mariadb is probably initialized In/var/lib/mysql already
is done. 10:37:04 system Mariadb-prepare-db-dir:if This isn't the case, make sure The/var/lib/mysql is empty before ng Mariadb-prepare-db-dir 10:37:05 system mysqld_safe:180128 10:37:05 mysqld_safe Logging to '/var/log/mariadb/ma
Riadb.log '.
10:37:05 system mysqld_safe:180128 10:37:05 Mysqld_safe starting mysqld daemon with databases From/var/lib/mysql
10:37:07 system systemd:started MARIADB database server.
10:40:01 System systemd:started Session 9064 of user root.
 10:40:01 System systemd:starting Session 9064 of user root.

After configuration, systemctl restart mariadb has been hanging, but not starting to judge is used for Mysql_safe, (previously encountered MySQL did not completely quit,

Start mariadb prompt and reboot. The MySQL can be completely killed after the restart.

Because MySQL has a daemon, mysql_safe so, so every time forced to kill, he will automatically start

You can kill the MySQL service in the following ways: Services mysqld stop

Ps-ef|grep MySQL | grep-v grep |awk ' {print $} ' | Xargs kill-9 batch kills MySQL process, but still can't kill all MySQL process.

It turns out it was/etc/my.cnf.

The path to the slow query in is not a full path

Slow_query_log=on
slow_query_log_file=/data/mysql/auditlogs/
Long_query_time=1

After modification:

Slow_query_log=on
Slow_query_log_file=/data/mysql/auditlogs/slow.log
Long_query_time=1

Smooth reboot

Add:

Configure MySQL log audit is not required full path

server_audit_events= ' CONNECT,QUERY,TABLE,QUERY_DDL,QUERY_DML,QUERY_DCL '
Server_audit_logging=on
Server_audit_file_path =/data/mysql/auditlogs/
server_audit_file_rotate_size=2000000
server_audit_file_rotations=200
Server_audit_file_rotate_now=on



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.