mysqlmacosprocessosx-mavericks

Do mysql connection ids always increment, even if lower connections have been terminated?


I'm setting up mysql and have noticed that whenever I connect, the connection id always increments. I thought that might mean the connection I thought had terminated didn't, but when I checked the number of connections using sudo mysqladmin processlist, it only listed the connection needed for that one command.

Normally I would just assume this was normal behavior and ignore it, but I had some problems uninstalling my old/messy installation from back when I didn't know what I was doing. Can anyone verify that this is normal? I tried checking the mysql manual here but it wasn't specific enough to answer my question.


Solution

  • To list all processes running on a MySQL instance state a query like this:

    SHOW PROCESSLIST
    

    Each Connection will have a representation here (inactive ones with Command column = Sleep).

    As to your question: No, Connection-ids will get re-used and will not increment forever. But you can't rely on the exact way they do so.