Log into the server
[Email protected]_25 ~]# su-mysql[[email protected]_25 ~]$ mysql.localwelcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 126000553Server version:5.5.27-log sourcedistribution Copyright (c) # D, Oracle and/or Itsaffiliates. All rights reserved. Oracle is a registered trademark of oraclecorporation and/or itsaffiliates. Names may trademarksof their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' toclear the current input statement.
You can see if the monitoring log is turned on (off is off) on is on
[Email protected]:(none) >show global variables like ' general_log% '; +------------------+------------------------- --+| Variable_name | Value |+------------------+---------------------------+| general_log | OFF
To view the current system log size
[Email protected]:(none) >system du-h/data/mysql/log/mysql.log1.7m /data/mysql/log/mysql.log
Open Log Success
You can then go directly into the shell to view our SQL session information based on the SQL feature
[[Email protected]_25 ~]# grep "forupdate"/data/mysql/log/mysql.log 126002192 Query Select PK Fromt_gantt_chart Where PK =47 for update<p>//ignores other data. </p>
Perform a look at the current session information
[[email protected]_25~]# grep 126002192/data/mysql/log/mysql.log 126002192Connect [email& Nbsp;protected] on test 126002192Query/* mysql-connector-java-5.1.6 (Revision: ${SVN. Revision}) */show VARIABLES WHERE variable_name = ' language ' orvariable_name = ' net_write_timeout ' OR variable_name = ' int Eractive_timeout ' orvariable_name = ' wait_timeout ' OR variable_name = ' character_set_client ' ORVariable_name = ' Character_set_connection ' or variable_name = ' character_set ' or variable_name = ' character_set_server ' or Variable_name = ' tx_isolation ' orvariable_name = ' transaction_isolation ' or variable_name = ' character_set_results ' or Variable_name = ' TimeZone ' or variable_name = ' time_zone ' or variable_name = ' system_time_zone ' or variable_name = ' lower_case_table_names ' or variable_name = ' max_allowed_packet ' orvariable_name = ' net_buffer_length ' OR variable_name = ' Sql_mode ' ORVariable_na me = ' Query_cache_type ' OR variable_name = ' Query_cache_size ' orvariable_name = ' init_connect ' 126002192Query SHOW COLLATION 126002192Quer Y set character_set_results = NULL 126002192Query set autocommit=1 126002192Quer Y setsql_mode= ' strict_trans_tables ' 141017 11:20:49 126002192 Query setautocommit=0 126002192Q Uery commit 126002192Query SET autocommit=1 126002192Query Select *....sql too long Ignore 126002192Query SelectCount (Last_password_change) from T_pf_user 126002192Query Select count (password_salt) Fromt_pf_user 126002192Query SELECT count (Comment_of_attendee) from T_PL Ugin_calendar_event_attendee 126002192Query SELECT COUNT (ext_subscription) from T_plugin_calendar 126002192Query SelectCount (ext_subscription_calendar_binary) from T_plugin_calendar 126 002192Query SelectcouNT (Ext_subscription_hash) from T_plugin_calendar 126002192Query selectcount (ext_subscription_url) FRO M T_plugin_calendar 126002192Query SelectCount (ext_subscription_update_interval) from T_plugin_calend AR 126002192Query Select COUNT (*) Fromt_plugin_todo 126002192Query Select count ( *) Fromt_plugin_memo//sql too long ignores 126002192Query SELECT @ @session. tx_isolation 126002192Query SET SESSION TRANSACTION isolationlevel repeatable READ 126002192Query SE T autocommit=0 126002192Query Select *....sql too long ignores 126002192Query select *....SQ L Too long ignore 126002192Query select *....sql too long ignore 126002192Query select *....sql too long ignore 126002192Query Select *....sql too long ignores 126002192Query select PK from T_gantt_char Twhere PK =47 for update 126002192Query Select *....sql too long ignores 126002192Query select *....sql too long ignored 126002192Query Select *....sql too long ignores 126002192Query select *....sql too long ignored 126002192Query Select *....sql too long ignores 126002192Query select *....sql too long ignored 126002192Query Select *....sql too long ignore 126002192Query select *....sql too long ignore 12600 2192Query Select *....sql too long ignore 126002192Query select *....sql too long ignore 126002192Qu ery Select *....sql too long ignores 126002192Query update t_gantt_object setcreated= ' 2014-08-19 16:56:49 ', D Eleted=0, last_update= ' 2014-08-23 14:20:42 ', duration=0, enddate= ' 2014-08-13 00:00:00 ', Oid=-1, orderValue=20, Parentid=237,preid=-1, Predecessoroffset=0, progress=100, Refid=-1, relationtype= ' Start_start ', startDate= ' 2014-08-05 00:00:00 ', id=96, title= ' 01_ system design ', type= ' aCtivity ', visible=1 where pk=238 126002192Query update T_gantt_chart setcreated= ' 2014-08-19 16:56:49 ' , Deleted=0, last_update= ' 2014-10-17 11:22:18 ', gantt_objects_as_xml=237, name= ' 3D project ', owner_fk=8,read_access= ' all ', Settings_as_xml= ' <ganttchartsettings><title>3d Project </title><opennodes/></ Ganttchartsettings> ', style_as_xml= ' <ganttchartstyle xticks= "AUTO" width= "" "/>", task_fk=94, Write_ Access= ' All ' where pk=47 126002192Query update t_gantt_object setcreated= ' 2014-08-19 17:57:01 ', delet Ed=0, last_update= ' 2014-08-23 14:20:42 ', duration=0, enddate= ' 2014-10-18 00:00:00 ', oid=3, orderValue=20, parentId=241 , preid=219, Predecessoroffset=0, Progress=null, refid=2, relationtype= ' Start_start ', startdate= ' 2014-10-15 00:00:00 ' , id=100, title= ' promotional data ', type= ' activity ', visible=1 where pk=243 126002192Query commit 126002192Query set Autocommit=1 126002192Query set SESSION TRANSACTION IsolationLevel READ COMMITTED
According to the above log, it can be clearly concluded that:
After setting the set Autocommit=1 SQL is not going to go to the transaction,
After set autocommit=0, the transaction is gone before the commit. The complete.
Do not forget to close the log after analysis, otherwise it would affect the performance of the OH
[Email protected]:(none) >set global general_log=off; Query OK, 0 rows Affected (0.00 sec) [email protected]:(none) >show global variables like ' general_log% '; +-------------- ----+---------------------------+| Variable_name | Value |+------------------+---------------------------+| general_log | OFF | | general_log_file |/data/mysql/log/mysql.log |+------------------+---------------------------+2 rows in Set (0.00 sec) [email protected]:(None) >
MySQL to see if SQL goes business