Assignment of Thread IDs? I'm in the process of decommissioning an old mysql server.  Of course there's a few things left connecting to it periodically people had since forgotten about.  I turned on general query logging to get a better view of what was still going on there to track down the culprits and noticed something odd.  

There was an entry like:

870 Connect     &lt;user&gt;@&lt;server&gt; on


It went on and did it's thing ending with a 

870 Quit


The very next line was 

1143 Connect     &lt;user&gt;@&lt;server&gt;


Why the jump in thread IDs?  Just grepping out all the "Connect" lines there are bursts of incrementing thread ids +1 then varying size gaps for the next connect id.

Is this expected behavior?
Failed Connection Attempts will still increment the Process ID next to be assigned

Here is an example:

I will restart mysql on my PC (MySQL 5.5.12) and connect for the first time

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.12-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql&gt;


Then I connect to mysql with an intentional bad password

I then connect to mysql with the right password

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.12-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql&gt;


and BINGO a MySQL Connection ID of 3 instead of 2

There is a record of it in the Global Status variables

mysql&gt; show global status like 'abort%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| Aborted_clients  | 0     |
| Aborted_connects | 1     |
+------------------+-------+
2 rows in set (0.00 sec)

mysql&gt;


You evidently have connections still coming in from somewhere who can no longer authenticate. Maybe you could try using netstat and watch port 3306. If your have removed certain user@host values from mysql.user, then there is no need for real concern in terms of the process ID established and used.

You may want to run this query now and then...

SELECT hostaddr,COUNT(1) connections FROM
(SELECT LEFT(host,LOCATE(':',host) - 1) hostaddr
FROM information_schema.processlist
WHERE LOCATE(':',host) &gt; 0) A
GROUP BY hostaddr;


This will tell you how many connections are coming in per IP address or DNS Name