In mysql, log files are generally stored in the "/var/log/" directory; you can use the "show master status" statement to view the current log file, or you can modify the mysqld log in the configuration file related content to modify the location where the log file is stored.
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
Where are the log files in mysql?
Log files mainly include error log files, binary log files, slow query log files, query log files, redo log files, etc.
MySQL logs are generally saved in the /var/log/ directory, but you need to look at the specific configuration file to determine. The specific method is as follows:
1. First log in to mysql: >mysql -u root -p
2. Then check whether the log is enabled mysql>show variables like 'log_%';
3. Check the current log mysql> show master status;
4. You need Known mysql log types: Error log: -log-err
Query log: -log
Slow query log: -log- slow-queries
Update log: -log-update
Binary log: -log-bin
5. Modify the configuration /etc/my.cnf (the following is the log file storage location) [mysqld]
log=/var/log/mysqld_common.log log-error=/var/log/mysqld_err.log log-bin=/var/log/mysqld_bin.bin
Expand knowledge:
Below This article gives a detailed introduction to mssql log files. If you are interested in mysql log files, you may wish to take a look.
1. Error Log Error Log
The error log records all serious warnings and error messages during the operation of mysql server, as well as detailed information about each startup and shutdown of mysql.
To enable the method, add the --log-error option when starting mysql. The error log is placed in the data directory by default and is named hostname.err. However, you can use the command --log-error[=file_name] to modify the storage directory and file name.
Sometimes, you want to back up the error log and restart recording. Use the flush logs command to backup the file ending in .old.
2. Binary log: Binary Log&Binary Log Index
is often referred to as binlog, which is one of the most important logs in mysql. After turning on the logging function through --log-bin[=file_name], mysql will record all queries that modify database data into the log file in binary form, including the execution time and resources consumed by each query. , and related transaction information. If file_name is not specified, it will be recorded as mysql-bin.**** in the data directory.
Binlog also has some other additional option parameters:
--max_binlog_size sets the maximum storage limit of binlog. When the log reaches this limit, a file will be re-created. Record.
--binlog-do-db=db_name parameter tells mysql to only log binlog to a certain database
--binlog-ignore-db The =db_name parameter tells mysql to ignore binlog records for a certain database
3. Update log: update log
Not supported after mysql5.0, similar to binlog, but not Recorded in binary form, it is a simple text format record
4. Query log: query log
Query log records all queries in mysql, which can be opened through --log[=file_name] Since this log records all queries, it is large in size and has a great impact on performance after being turned on. This function is only turned on briefly when tracking some special query performance issues. The default file name is hostname.log.
5. Slow query log: slow query log
Use --log-slow-queries[=file_name] to turn on this function and set the recording location and file name. The default file name is: hostname -slow.log, the default directory is also the data directory.
6.InnoDB’s online REDO log: InnoDB REDO Log
The REDO log records all physical changes and transaction information made by InnoDB. Through REDO logs and UNDO information, InnoDB ensures Transaction security under all circumstances. InnoDB's REDO log is also stored in the data directory by default. You can change the storage location of the log through innodb_log_group_home_dir. Set the number of logs through innodb_log_files_in_group.
How to modify the location of the MYSQL database log file?
I believe everyone knows a lot about MySQL log files. MySQL log files are generally located at:/var/log/mysqld.log. The following will teach you how to modify the location of the MySQL log file for your reference.
Today I need to change the location of the MySQL log file, but I found that it cannot be changed in /etc/my.cnf.
Later I discovered that the MySQL log bit is specified:
Recommended learning: mysql video tutorial
The above is the detailed content of Where is the log file in mysql. For more information, please follow other related articles on the PHP Chinese website!

The steps to create and manage user accounts in MySQL are as follows: 1. Create a user: Use CREATEUSER'newuser'@'localhost'IDENTIFIEDBY'password'; 2. Assign permissions: Use GRANTSELECT, INSERT, UPDATEONmydatabase.TO'newuser'@'localhost'; 3. Fix permission error: Use REVOKEALLPRIVILEGESONmydatabase.FROM'newuser'@'localhost'; then reassign permissions; 4. Optimization permissions: Use SHOWGRA

MySQL is suitable for rapid development and small and medium-sized applications, while Oracle is suitable for large enterprises and high availability needs. 1) MySQL is open source and easy to use, suitable for web applications and small and medium-sized enterprises. 2) Oracle is powerful and suitable for large enterprises and government agencies. 3) MySQL supports a variety of storage engines, and Oracle provides rich enterprise-level functions.

The disadvantages of MySQL compared to other relational databases include: 1. Performance issues: You may encounter bottlenecks when processing large-scale data, and PostgreSQL performs better in complex queries and big data processing. 2. Scalability: The horizontal scaling ability is not as good as Google Spanner and Amazon Aurora. 3. Functional limitations: Not as good as PostgreSQL and Oracle in advanced functions, some functions require more custom code and maintenance.

MySQL supports four JOIN types: INNERJOIN, LEFTJOIN, RIGHTJOIN and FULLOUTERJOIN. 1.INNERJOIN is used to match rows in two tables and return results that meet the criteria. 2.LEFTJOIN returns all rows in the left table, even if the right table does not match. 3. RIGHTJOIN is opposite to LEFTJOIN and returns all rows in the right table. 4.FULLOUTERJOIN returns all rows in the two tables that meet or do not meet the conditions.

MySQL's performance under high load has its advantages and disadvantages compared with other RDBMSs. 1) MySQL performs well under high loads through the InnoDB engine and optimization strategies such as indexing, query cache and partition tables. 2) PostgreSQL provides efficient concurrent read and write through the MVCC mechanism, while Oracle and Microsoft SQLServer improve performance through their respective optimization strategies. With reasonable configuration and optimization, MySQL can perform well in high load environments.

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Notepad++7.3.1
Easy-to-use and free code editor