Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Every query creates a new CONNECTION_ID()

Each and every SQL query I issue to my MySQL server creates a new (increments) CONNECTION_ID(). This happens both on my local as well as on my shared remote server.

Is this the reason behind LAST_INSERT_ID() and ROW_COUNT() resulting in 0? How to address this issue?

Originally in MySQL: LAST_INSERT_ID() returns 0

like image 979
dwelle Avatar asked Dec 14 '12 16:12

dwelle


People also ask

What is Connection_id?

The MySQL CONNECTION_ID() function is used for return the connection ID for a current connection in MySQL. The connection ID used to establish a connection to a database is unique for every connection among the connected clients. The CONNECTION_ID() function does not require any parameters or arguments.

What is Row_count () in MySQL?

In MySQL the ROW_COUNT() function is used to return the number of rows affected by the previous SQL statement. If the previous statement was not one that could potentially change data rows or you can say, it wasn't an INSERT, UPDATE, DELETE or other such statement this function will return -1.

How do I find MySQL connection ID?

mysql> SELECT CURRENT_USER(); Here is the output that displays the name of the current user. In the above, % tells us about localhost. mysql> SELECT CONNECTION_ID();

What is id in MySQL?

Authentication ID Each row in the mysql. user table is identified by a user and host tuple. This tuple is the authorization ID. A client can authenticate with an authorization ID and a password. The ID is then referred to as a user or user name.


1 Answers

By default, PersistentConnections are disabled in phpMyAdmin.

Is this the reason behind LAST_INSERT_ID() and ROW_COUNT() resulting in 0?

Yes.

How to address this issue?

Enable persistent connections:

$cfg['PersistentConnections'] = TRUE;
like image 72
eggyal Avatar answered Oct 04 '22 10:10

eggyal