
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Find Out Port of MySQL Server
To find the port of the MySQL server, the command show can be used. Its syntax is as follows −
show variables where variable_name=’port’;
The above syntax is used to get the port number of the MySQL server using the following query −
mysql> show variables where variable_name = 'port';
After executing the above command, port of MySQL server is obtained as 3306. This can be seen in the following output −
+---------------+-------+ | Variable_name | Value | +---------------+-------+ | port | 3306 | +---------------+-------+ 1 row in set (0.01 sec)
Alternatively, the system variable @@port can also be used to find the MySQL server port. This is demonstrated by the following query −
mysql> SELECT @@port;
The output of the above query is as follows −
+--------+ | @@port | +--------+ | 3306 | +--------+ 1 row in set (0.00 sec)
The above output also gives the port of MySQL server as 3306.
Advertisements