- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to display current connection info in MySQL?
MySQL provides many functions that give the current connection information. For instance, to know about the current user, use the user() function.
mysql> SELECT CURRENT_USER();
Here is the output that displays the name of the current user.
+----------------+ | CURRENT_USER() | +----------------+ | root@% | +----------------+ 1 row in set (0.00 sec)
In the above, % tells us about localhost.
To check the current connection id, use the following method −
mysql> SELECT CONNECTION_ID();
The following is the output that shows the current connection id.
+-----------------+ | CONNECTION_ID() | +-----------------+ | 8 | +-----------------+ 1 row in set (0.02 sec)
The following is the syntax to check all the current information with a single command.
The following is the output −
-------------- C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe Ver 8.0.12 for Win64 on x86_64 (MySQL Community Server - GPL) Connection id: 8 Current database: business Current user: root@localhost SSL: Cipher in use is DHE-RSA-AES128-GCM-SHA256 Using delimiter: ; Server version: 8.0.12 MySQL Community Server - GPL Protocol version: 10 Connection: localhost via TCP/IP Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: cp850 Conn. characterset: cp850 TCP port: 3306 Uptime: 1 hour 11 min 24 sec Threads: 2 Questions: 26 Slow queries: 0 Opens: 129 Flush tables: 2 Open tables: 105 Queries per second avg: 0.006 --------------
- How to get current internet connection type in android?
- How to display the storage engine while implementing JDBC - MySQL CONNECTION query?
- MySQL command for display current configuration variables?
- Display Timestamp before the current date in MySQL
- Fetch info with MySQL EXPLAIN KEYWORD?
- Display all records ignoring the current date record in MySQL
- How to keep the connection alive in MySQL Workbench?
- How to get device info in android?
- Display the current mask in Numpy
- MySQL: Testing connection with query?
- Connection Transport Protocols for MySQL
- How to display the name of the Current Thread in C#?
- How to display the current working directory in the Linux system?
- How to get the current date to display in a Tkinter window?