欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

mysql show processlist show full query 显示完整的sql语句 全部的sql语句 有大用 有大大用

How to see full query from SHOW PROCESSLIST

When I issue SHOW PROCESSLIST query, only first 100 characters of the running SQL query are returned in the info column.

Is it possible to change Mysql config or issue a different kind of request to see complete query (the queries I'm looking at are longer than 100 characters)

4 Answers 正确答案 

up vote312down voteaccepted
SHOW FULL PROCESSLIST

If you don't use FULL"only the first 100 characters of each statement are shown in the Infofield".

When using phpMyAdmin, you should also click on the "Full texts" option ("← T →" on top left corner of a results table) to see untruncated results.


image.png

shareimprove this answeredited Jun 25 '16 at 16:43poolie5,77612955answered Sep 3 '10 at 18:48James McNellis268k52762883

2 It seems phpmyadmin does not care about this, and still shows the truncated info. – giorgio79 Aug 28 '12 at 12:41   @giorgio79: If I recall correctly, phpMyAdmin truncates all string results. It's been four years since I did any web development, though, so I could very well be mistaken. – James McNellis Aug 28 '12 at 15:295 +1 for the phpMyAdmin note. – Cyntech Apr 22 '13 at 4:131 I'm seeing queries getting truncated after a certain length even when using SHOW FULL PROCESSLIST. Can I make it even fuller somehow? – wizonesolutions Aug 21 '14 at 21:16   the command SHOW FULL PROCESSLIST needs a semi-colon ; at the end right? – R.Haq Nov 22 at 7:10

Show Processlist fetches the information from another table. Here is how you can pull the data and look at 'INFO' column which contains the whole query :

select * from INFORMATION_SCHEMA.PROCESSLIST where db = 'somedb';

You can add any condition or ignore based on your requirement.

The output of the query is resulted as :

+-------+------+-----------------+--------+---------+------+-----------+----------------------------------------------------------+| ID    | USER | HOST            | DB     | COMMAND | TIME | STATE     | INFO                                                     |+-------+------+-----------------+--------+---------+------+-----------+----------------------------------------------------------+|     5 | ssss | localhost:41060 | somedb | Sleep   |    3 |           | NULL                                                     || 58169 | root | localhost       | somedb | Query   |    0 | executing | select * from sometable where tblColumnName = 'someName' |
shareimprove this answeredited Oct 13 '16 at 9:57manatwork1,39411924answered Jan 20 '16 at 20:59Yogesh Sakurikar515410

4 This is probably the most useful answer. – dr01 Nov 24 '16 at 9:40

I just read in the MySQL documentation that SHOW FULL PROCESSLIST by default only lists the threads from your current user connection.

Quote from the MySQL SHOW FULL PROCESSLIST documentation:

If you have the PROCESS privilege, you can see all threads.

So you can enable the Process_priv column in your mysql.user table. Remember to execute FLUSH PRIVILEGES afterwards :)

shareimprove this answeranswered Mar 14 '13 at 14:11hardcoder36849

this solution worked for me:

  • open terminal and login to mysql server

  • open new terminal and restart the mysqld service (don't close first terminal)

  • on first terminal run "slave stop"

  • on first terminal run "slave start"

  • you will see slave/master will start working fine with no error

shareimprove this answeranswered Mar 31 '14 at 17:44Reza1

4 This ain't about multi-node sql deployments. – sjas Sep 2 '15 at 9:04

protected by tchrist Aug 24 at 23:14

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count). 

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged  or ask your own question

来自 https://stackoverflow.com/questions/3638689/how-to-see-full-query-from-show-processlist

普通分类: