Settings for MySQL 5.6.19 general_log under Windows

Source: Internet
Author: User

MySQL 5.6.19 general_log is off by default, it should be said that the MySQL general_log default is closed, no specific version and platform

One, enable General_log from the configuration file

The configuration file for MySQL under Windows is My.ini, before the path is introduced; Linux seems to be my.cnf.

Open My.ini with Notepad and find

#General and Slow logging.

Log-output=none

General-log=0

general_log_file= "Computer name. Log"

Annotate all of the above (I don't usually delete the default value of the system), and then write again

Log-output=file

General-log=1

General_log_file= "Mysql.log"

This changes after the completion of the forgotten to do not restart the MySQL service, should be

This general_log enabled, and output to Mysql.log, this is the relative path, the directory is E:\ProgramData\MySQL\MySQL Server 5.6\data, of course, it is also related to the path you installed

General_log_file= "" can also set the absolute path, according to their own needs to set

Second, use command settings

Without modifying the configuration file, I am using the Workbench connection to the MySQL server to operate with root privileges.

See if General_log is turned on

Show variables like ' general_log% ';

Set log output to file

Set Global Log_output=file

(Note: This file forgot to do the single quotation mark, as if not, but if the table, the following will refer to table)

Set the log file path for general log

Set global general_log_file= ' Mysql.log '

To open General log:

Set global general_log=on;

It's actually something in the config file that's changed with the command.

However, this modification will need to be reset every time the MySQL service is restarted.

Iii. about table in the second step

"Starting with MySQL version 5.1.6, general query log and slow query log begin to support writing to a file or database table in two ways," This sentence refers to the online, not to find the official documents

Put in the table directly with select query more convenient, do not need to go to the system under the log file. Just do it right in the database. In particular, database accounts that use specific permissions operate the database remotely.

A few days ago there is such a demand, I think only the database account, generate the log I want to go into a specific directory to view the log file Ah, this permission needs to be set Ah, the operating system is Linux.

Use the command settings:

Set global log_output= ' table '

(This must be a single quotation mark)

Set global general_log=on;

And then you can query from the table.

SELECT * FROM Mysql.general_log

We can look at the field type of General_log.

Use MySQL;

Show columns in General_log;

Set global general_log_file does not require a

The configuration in the configuration file should be similar to the command line.

I do not know why, my Computer home shutdown, work when the boot, using SELECT * from Mysql.general_log unexpectedly recorded my work after the operation, this restart MySQL service, records will be written in the table.

Four, authorized super permission to the specified user

To turn on General_log, you need super privilege

Root account grants Super permission to test

Grant Super on * * to [email protected]

Administrative permissions (such as Super,process,file, etc.) are not able to make a database, on the following must be followed by *. * (This is also seen from the Internet, of course I use grant super on test.* to [email protected] error )

The grant under MySQL was also used for the first time, possibly before, forgetting

The first time to start a MySQL log, from the company's needs. I don't know at first. mysql logs are turned off by default. Anyway, a little bit of answers.

Now is a summary.

The middle also involves creating new users, which should be summed up recently.

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.