File format:
frm, MYI, MYD are table structures \ Indexes \ Data files for MyISAM tables, respectively
A library in a directory
However, in MySQL version 4.0 and above,
You can use the DATA directory= "directory" or the index directory= "directory" in the CREATE table statement to specify where the storage engine holds its tables and index text Thing Note that the directory must be specified as a full path (not a relative path). This only works on the MyISAM table in MySQL 4.0, and you do not use the--skip-symlink option. View Chapter 5.6.1.2 use symbolic links to tables.
The log file can be a file,
It can also be multiple files, producing one at a time on each system startup, with the extension. 000, incrementing
A configuration item in a system configuration file my.cnf or My.ini is determined using a file or multiple log files
Log:
Log in to MySQL terminal
Log file path
Mysql> Show variables like ' general_log_file ';
+------------------+------------------------------------+
| variable_name | Value |
+------------------+------------------------------------+
| General_log_file | /usr/local/mysql/data/localhost.log |
+------------------+------------------------------------+
1 row in Set (0.00 sec)
Error log file path
Mysql> Show variables like ' log_error ';
+---------------+------------------------------------+
| variable_name | Value |
+---------------+------------------------------------+
| Log_error | /usr/local/mysql/data/localhost.err |
+---------------+------------------------------------+
1 row in Set (0.00 sec)
Slow query log file path
Mysql> Show variables like ' slow_query_log_file ';
+---------------------+-----------------------------------------+
| variable_name | Value |
+---------------------+-----------------------------------------+
| Slow_query_log_file | /usr/local/mysql/data/localhost-slow.log |
+---------------------+-----------------------------------------+
1 row in Set (0.01 sec)
MySQL has the following types of logs:
Error log:-log-err
Query log:-log
Slow query log:-log-slow-queries
Update log:-log-update
Binary log:-log-bin
Whether the log is enabled
Mysql>show variables like ' log_% ';
How to know the current log
Mysql> Show master status;
Show binary log Entries
Mysql> show master logs;
See binary log files with Mysqlbinlog
Shell>mysqlbinlog mail-bin.000001
or Shell>mysqlbinlog mail-bin.000001 | Tail
Mysqlbinlog localhost-bin.000202 > New_file_name.log command, save the target file as a log file, you can specify a save path under a small trick to introduce, I am ready to convert the log file to find more than 2G, Wondering why MySQL didn't put the logs on a regular basis in multiple files. It turns out that MySQL has a better way to get data for a certain time period through time parameters, such as: Mysqlbinlog--start-datetime= "2010-11-20 00:00:00"--stop-datetime= " 2010-11-21 00:00:00 "
Specify the output location of the log in the configuration file.
The windows:windows configuration file is My.ini, usually under the MySQL installation directory or under C:\Windows.
The Linux:linux configuration file is my.cnf, usually in/etc.
Under Linux:
SQL code
- # Enter in [mysqld]
- #log
- log-error=/usr/Local/mysql/log/error.log
- log=/usr/Local/mysql/log/mysql.log
- long_query_time=2
- log-slow-queries=/usr/Local/mysql/log/slowquery.log
Under Windows:
SQL code
- # Enter in [mysqld]
- #log
- log-error="E:/progra~1/easyph~1.0b1/mysql/logs/error.log"
- log="E:/progra~1/easyph~1.0b1/mysql/logs/mysql.log"
- long_query_time=2
- log-slow-queries= "E:/progra~1/easyph~1.0b1/mysql/logs/slowquery.log"
Turn on Slow query
Long_query_time = 2-refers to how long the SQL executed will be log down, here is 2 seconds
log-slow-queries=/usr/local/mysql/log/slowquery.log--Log the query back to a slower statement
Log-queries-not-using-indexes = nouseindex.log--literally, log down without using the indexed query
Log=mylog.log--Record all execution statements
MySQL Knowledge points