Collections:
Turn on Query Logs in MySQL
How To Turn on Query Logs in MySQL?
✍: FYIcenter.com
If you want MySQL to write query logs to a file, you can use the "--log=fileName" option at the "mysqld" command line. The tutorial exercise below shows you a good example on how to use this option and view the query log file:
>cd \mysql\bin >mkdir \mysql\logs >mysqld --log=\mysql\logs\query.log
Starts another command window, and enter the following commands:
>cd \mysql\bin >mysql -u root -pretneciyf mysql> USE test; Database changed mysql> show tables; +----------------+ | Tables_in_test | +----------------+ | articles | | links | | test | +----------------+ 3 rows in set (0.03 sec) mysql> SELECT * FROM links; +------+-------------------+ | id | name | +------+-------------------+ | 1 | dba.fyicenter.com | | 10 | dba.fyicenter.com | +------+-------------------+ 2 rows in set (0.11 sec) mysql> EXIT; Bye
Here is what you will get in the query log file:
>type \mysql\logs\query.log
mysqld, Version: 5.0.24-community-log. started with:
Tcp port: 0 Unix socket: (null)
Time Id Command Argument
20:19:41 3 Connect root@localhost on
20:20:00 3 Query SELECT DATABASE()
3 Init DB test
20:20:05 3 Query show tables
20:20:52 3 Query SELECT * FROM links
20:21:02 3 Quit
⇐ Memory Usage of the MySQL Server in MySQL
2017-12-04, 2159🔥, 0💬
Popular Posts:
How To End a Stored Procedure Properly in SQL Server Transact-SQL? Where the end of the "CREATE PROC...
How To Use SQL*Plus Built-in Timers in Oracle? If you don't have a stopwatch/timer and want to measu...
How To Convert Characters to Numbers in Oracle? You can convert characters to numbers by using the T...
What are DDL (Data Definition Language) statements for tables in SQL Server? DDL (Data Definition La...
How To Insert New Line Characters into Strings in SQL Server Transact-SQL? If you want to break a st...