EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login
Home Data Science Data Science Tutorials MySQL Tutorial MySQL Log File
Secondary Sidebar
MySQL Tutorial
  • Advanced
    • MySQL Formatter
    • MySQL TINYINT
    • MySQL Grant All Privileges
    • MySQL DROP TABLE
    • MySQL rename database
    • MySQL Flush Privileges
    • MySQL super Privilege
    • MySQL Character Set
    • MySQL Log File
    • MySQL Flush Log
    • Grant Privileges MySQL
    • MySQL WHILE LOOP
    • IF Statement in MySQL
    • MySQL CASE Statement
    • MySQL IF Function
    • MySQL IF EXISTS
    • MySQL UUID
    • Views in MySQL
    • MySQL Replication
    • MySQL Partition
    • Toad for MySQL
    • Navicat for MySQL
    • MySQL AES_Encrypt
    • MySQL Performance Tuning
    • MySQL Transaction
    • MySQL? sort_buffer_size
    • MySQL? Sync
    • MySQL? Query Cache
    • MySQL Collation
    • MySQL ODBC Driver
    • MySQL Partitioning
    • MySQL InnoDB
    • MySQL Float vs Decimal
    • MySQL Union vs Union All
  • Basic
    • MySQL floor
    • MySQL DESCRIBE table
    • MySQL encryption
    • Introduction to MySQL
    • Is SQL Server a Database?
    • What is MySQL
    • Is MySQL Programming Language
    • MySQL Server
    • MySQL AB
    • MySQL Community Server
    • How To Install MySQL
    • MySQL Versions
    • MySQL OpenSource
    • MySQL GUI Tools
    • MySQL Grant
    • MySQL Error 1064
    • MySQL Drop Database
    • MySQL not equal
    • MySQL SELECT INTO Variable
    • MySQL Commands
    • MySQL Operators
    • What is MySQL Schema
    • Wildcards in MySQL
    • MySQL Constraints
    • MySQL Administration
    • MySQL Data Type
    • MYSQL COMMIT
    • MySQL FORMAT
    • Timestamp to Date in MySQL
    • MySQL DATEDIFF
    • MySQL?Incremental Backup
    • MySQL JSON Data Type
    • MySQL ENUM
    • MySQL Default Port
    • Cheat Sheet MySQL
  • Queries
    • MySQL Queries
    • MySQL Query Commands
    • SELECT in MySQL
    • MySQL INSERT IGNORE
    • MySQL having
    • ORDER BY in MySQL
    • MySQL Cheat Sheet
    • MySQL ORDER BY Random
    • MySQL ORDER BY DESC
    • MySQL GROUP BY
    • MySQL GROUP BY Count
    • MySQL GROUP BY month
    • MySQL WHERE Clause
    • MySQL WITH
    • MySQL FETCH
    • MySQL DDL
    • MySQL DML
    • MySQL WHERE IN Array
    • MySQL Fetch Array
    • MySQL ISNULL
    • MySQL Index Types
    • Mysql? Export Schema
    • Amazon RDS for MySQL
    • MySQL greatest
  • Database
    • What is Data Modeling
    • What is Data Processing
    • DBMS Architecture
    • DBMS Keys
    • Careers in Database Administration
    • What is MySQL Database
    • MySQL Relational Database
    • How to Connect Database to MySQL
    • MySQL Database Repair
    • RDBMS Interview Questions
    • DBMS Interview Questions
  • Functions
    • MySQL Function
    • MySQL Aggregate Function
    • MySQL String functions
    • MySQL Date Functions
    • MySQL Window Functions
    • MySQL Math Functions
    • MySQL Boolean
    • Cursor in MySQL
    • Condition in MySQL
    • MySQL BETWEEN
    • Insert in MySQL
    • MySQL IFNULL()
    • MySQL TIMESTAMPDIFF()
    • MySQL COALESCE()
    • MySQL count()
    • MIN() in MySQL
    • MySQL Numeric
    • MySQL field()
    • MySQL FIND_IN_SET()
    • MySQL avg()
    • MySQL MAX() Function
    • MySQL BIN()
    • MySQL Concat
    • MySQL DECODE()
    • MySQL REGEXP_REPLACE()
    • MySQL Asynchronous
    • MySQL innodb_buffer_pool_size
    • MySQL key_buffer_size
    • MySQL TRUNCATE()
    • MySQL ROW_NUMBER()
    • NOT in MySQL
    • MySQL IN Operator
    • LIKE in MySQL
    • ANY in MySQL
    • MySQL NOT IN
    • MySQL CHECK Constraint
    • MySQL DISTINCT
    • MySQL ALL
    • MySQL Union
    • MySQL UNION ALL
    • MySQL EXISTS
    • MySQL ON DELETE CASCADE
    • MySQL REGEXP
    • MySQL Index
    • MySQL Add Index
    • MySQL REINDEX
    • MySQL UNIQUE INDEX
    • MySQL Clustered Index
    • MySQL? InnoDB Cluster
    • Table in MySQL
    • ALTER TABLE MySQL
    • MySQL Temporary Table
    • MySQL Clone Table
    • MySQL Repair Table
    • MySQL Lock Table
    • MySQL Optimize Table
    • TRUNCATE TABLE MySQL
    • MySQL Table Dump
    • MySQL Update Set
    • MySQL ALTER TABLE Add Column
    • MySQL RANK()
    • MySQL CTE
    • MySQL LAG()
    • MySQL GROUP_CONCAT()
    • MySQL EXTRACT()
    • MySQL REPLACE
    • MySQL AUTO_INCREMENT
    • MySQL SYSDATE()
    • MySQL NULLIF()
    • MySQL Substring
    • MySQL SUBSTRING_INDEX()
    • MySQL LOWERCASE
    • MySQL Row
    • MySQL NOW
    • MySQL CEIL
    • MySQL Alias
    • MySQL Trigger
    • MySQL SHOW Triggers
    • MySQL UPDATE Trigger
    • MySQL DELETE Trigger
    • MySQL AFTER UPDATE Trigger
    • MySQL Stored Procedure
    • ROLLUP in MySQL
    • MySQL? INSTR()
    • MySQL Subquery
    • MySQL Timestamp
    • MySQL? Hour()
    • MySQL MOD()
    • MySQL DATE_FORMAT()
    • ALTER Column in MySQL
    • MySQL Rename Column
    • MySQL Interval
    • MySQL CURDATE
    • MySQL BIT
    • MySQL Binlog
    • MySQL Average
    • MySQL TEXT
    • MySQL SHOW
    • MySQL Offset
    • MySQL Timezone
    • mysql_real_escape_string
    • MySQL Datetime
    • MySQL DATE_SUB()
    • MySQL FULLTEXT
    • MySQL DATE_ADD()
    • MySQL sum()
    • MySQL Merge
    • MySQL BigInt
    • MySQL ROUND
    • MySQL VARCHAR
    • MySQL Decimal
    • MySQL Limit
    • MySQL today()
    • MySQL WEEKDAY
    • MySQL Split
    • MySQL Create Function
    • MySQL BLOB
    • MySQL encode()
    • MySQL Primary Key
    • MySQL Foreign Key
    • Unique Key in MySQL
    • MySQL Drop Foreign Key
    • MySQL DROP TRIGGER
    • MYSQL Database
    • Delete Database MySQL
    • MySQL Root
    • MySQL Root Password
    • MySQL Client
    • MySQL Users
    • MySQL?User Permissions
    • MySQL add user
    • MySQL List User
    • MySQL Show Users
    • MySQL User Password
    • MySQL?Cardinality
    • MySQL Workbench
    • MySQL Backup
    • MySQL REVOKE
    • MySQL Dump
    • MySQL Cluster
    • MySQL Partitioning
    • MySQL Full Text Search
    • MySQL Admin Tool
    • MySQL Export Database
    • MySQL Export to CSV
  • Joins
    • Joins in MySQL
    • MySQL Outer Join
    • Left Outer Join in MySQL
    • MySQL Self Join
    • Natural Join in MySQL
    • MySQL DELETE JOIN
    • MySQL Update Join
    • MySQL Cross Join
  • Interview Questions
    • MySQL Interview Questions

Related Courses

MS SQL Certification Courses

Oracle Certification Courses

PL/SQL Certification Courses

MySQL Log File

By Roja MetlaRoja Metla

MySQL Log File

Introduction of MySQL Log File

MySQL log file consists of records of actions that has been performed. MySQL server generates log files that are generated based on the actions performed. The log files are of different types: – error logs, ISAM log, general query log, update log, binary log, and slow query log.

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (86,768 ratings)
  • Error log File: It consists of all the records that has been encountered while running, starting or stopping mysql.
  • ISAM Log File: It records all the changes that has been done to the ISAM tables.Used only for ISAM code debugging.
  • General Query Log File: Contains information regarding the connections established and executed queries.
  • Update Log File: Consists of information on all the changes that have been performed on data.
  • Binary Log File: Which consists of all the modification that happened in the database
  • Slow Query Log File: Stores all the details of the queries that took more than the “long_query_time” to execute.

Syntax of MySQL Log File

To check log location and settings the error log file in the shell:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

mysql -se "SHOW VARIABLES" | grep -e log_error

To check log location and settings the general log file in the shell:

mysql -se "SHOW VARIABLES" | grep-e general_log

To check log location and settings the slow query log file in the shell:

mysql -se "SHOW VARIABLES" | grep -e slow_query_log

How does MySQL Log File Works?

Now let us see the error log that records the information about the errors encountered while running, starting or stopping mysqld. In windows, we have the path called “C:\ProgramData\MySQL\MySQL Server 8.0\Data” which consists of the error log as mentioned in the below screenshot. The type of the error log file is “err”. Below we have highlighted the same.

MySQL Log File-1.1

1. Error Log File

We can see the details of the error log file in the “config” file (my.ini) from the path

“C:\ProgramData\MySQL\MySQL Server 8.0”.
# Error Logging.
log-error="LAPTOP-78SCO0PP.err"

MySQL Log File-1.2

2. General Log File

Contains information regarding the connections established and executed queries.We can see the details of the general log file in the “config” file (my.ini) from the path “C:\ProgramData\MySQL\MySQL Server 8.0”.

# General and Slow logging.
log-output=FILE
general-log=0
general_log_file="LAPTOP-78SCO0PP.log"

MySQL Log File-1.3

Here the “general-log” =0 which means that the general log is not enabled. To enable we need to set the value to “general-log” =1.

3. Binary Log File

Show BINARY LOGS

Output:

Log_name file_size Encrypted
LAPTOP-78SCO0PP-bin.000001 179 No
LAPTOP-78SCO0PP-bin.000002 2129912 No

mysqlbinlog log-file | mysql -h server_name

4. ISAM Log File

myisamlog processes contain the information of a MyISAM log file. In order to create the ISAM log file, we start the server with a –log-isam=log_file option. We just need to invoke myisamlog as below:

myisamlog [options] [file_name [tbl_name] …] Options can be of –c, -f, -F, -i, -o etc

5. Update Log File

The update log is replaced by the binary log. When the server is started, we mention the option with a file name as “–log-update[=file_name]” , mysqld writes a log file containing all SQL commands that update data like UPDATE or DELETE. It skips the UPDATE statements if the column value is already existing.

6. Slow Query Log File

Stores all the details of the queries that took more than the “long_query_time” to execute. Below is the query that shows the longest query executed.

We can see the details of the general log file in the “config” file (my.ini) from the path “C:\ProgramData\MySQL\MySQL Server 8.0”.

# Slow logging.
slow-query-log=1
slow_query_log_file="LAPTOP-78SCO0PP-slow.log"
long_query_time=10

Output-1.4

7. Error Log File

Once we open the “error” log file we get the below data information: –

  • InnoDB initialization has started.
  • InnoDB initialization has ended.
  • X Plugin ready for connections. Bind-address: ‘::’ port: 33060
  • CA certificate ca.pem is self signed.
Timestamp Thread Type Details
2020-05-31T09:34:06 0 [Warning] [MY-000081] [Server] option ‘read_buffer_size’: unsigned value 5120 adjusted to 8192.
2020-05-31T09:34:06 0 [Warning] [MY-010915] [Server] ‘NO_ZERO_DATE’, ‘NO_ZERO_IN_DATE’, and ‘ERROR_FOR_DIVISION_BY_ZERO’ sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2020-05-31T09:34:06 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.20) starting as process 16316
2020-05-31T09:34:06 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-05-31T09:34:13 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-05-31T09:34:14 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: ‘::’ port: 33060
2020-05-31T09:34:17 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-05-31T09:34:17 0 [System] [MY-010931] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: ‘8.0.20’ socket: ” port: 3306 MySQL Community Server – GPL.
2020-06-13T10:22:35 0 [System] [MY-013105] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Normal shutdown.
2020-06-13T10:23:20 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.20) MySQL Community Server – GPL.
2020-06-13T10:26:03 0 [Warning] [MY-000081] [Server] option ‘read_buffer_size’: unsigned value 5120 adjusted to 8192.
2020-06-13T10:26:03 0 [Warning] [MY-010915] [Server] ‘NO_ZERO_DATE’, ‘NO_ZERO_IN_DATE’ and ‘ERROR_FOR_DIVISION_BY_ZERO’ sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2020-06-13T10:26:04 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.20) starting as process 6292
2020-06-13T10:26:08 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-06-13T10:26:18 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-06-13T10:26:25 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: ‘::’ port: 33060
2020-06-13T10:26:29 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-06-13T10:26:30 0 [System] [MY-010931] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: ‘8.0.20’ socket: ” port: 3306 MySQL Community Server – GPL.

Output-1.5

8. Slow Query Log File

We can see the details of the general log file in the “config” file (my.ini) from the path “C:\ProgramData\MySQL\MySQL Server 8.0”.

Now let us see the slow query log file. Below are the details that we get from our database.

Start Time User@Host Query Time Lock Time Rows Sent Rows Examined Detail
2020-06-06T12:48:49 root[root] @ localhost [::1] Id: 32 11.770594 0.032157 174 960 use sourcedb;
SET timestamp=1591447717;
SELECT * FROM information_schema.`TABLES` T,
information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA
WHERE CCSA.collation_name = T.table_collation
LIMIT 0, 1000;

Output-1.6

Recommended Articles

This is a guide to MySQL Log File. Here we also discuss the introduction and how does mysql log file works along with examples and its code implementation. You may also have a look at the following articles to learn more –

  1. MySQL BIN()
  2. MySQL INSTR()
  3. MySQL WHILE LOOP
  4. MySQL Root
Popular Course in this category
MySQL Training Program (12 Courses, 10 Projects)
  12 Online Courses |  10 Hands-on Projects |  92+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

MS SQL Training (16 Courses, 11+ Projects)4.9
Oracle Training (14 Courses, 8+ Projects)4.8
PL SQL Training (4 Courses, 2+ Projects)4.7
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more