
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to 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.
- Related Articles
- MySQL Server port number?
- How do I find out the default server character set in MySQL?
- TCP/IP port in SAP HANA to access Index server
- TCP/IP port in SAP HANA to access Statistics server
- How to restart MySQL server?
- How to Find Open Port in Linux?
- How to copy tables or databases from one MySQL server to another MySQL server?
- How to Display System Variables of MySQL Server?
- How to find out number of days in a month in MySQL?
- How to upgrade MySQL server from command line?
- MySQL Server and Server-Startup Programs
- How can I start MySQL Server?
- How can I shutdown MySQL Server?
- Issue regarding JCo SAP Server out of Network
- What Is the Default MySQL Port Number?

Advertisements