Detailed Guide on MySQL Port

28 Min Read
mysql port

MySQL Port Introduction

MySQL Ports are one sort of instrument in network conventions that permits the server to deal with and deal with various customer’s associations and meetings in a specific organization. The default port of MySQL is 3306. The port is addressed and distinguished by a mathematical worth of 2 bytes that is 16 pieces in size. Out of them, 65536 port numbers are named ports that are additionally ordered dependent on the convention utilized for transport as TCP or UDP ports.

There are four kinds of convention esteems in particular, TCP utilized in every single working framework, PIPE, and MEMORY utilized in the Windows working framework and SOCKET that are utilized in Unix/Linux working frameworks. Every one of these convention esteems are utilized for setting up and keeping up with the association with a remote or neighborhood server. In MySQL TCP/IP attachments are utilized to associate with the customers that are arranged from a distance.

In this article, we will perceive how the ports at present being utilized are recovered and how to check your MySQL port and associate with the MySQL data set server utilizing your default MySQL port and how we can change the default port used to interface with MySQL utilizing the arrangement document.

mysql port

Checking the MySQL port you are utilizing

At the point when you are associated with the MySQL server and you need to check the port that is being utilized by your customer to interface with MySQL server, you can recover the worth of the variable named port that stores the port number utilized for the association. This should be possible in the accompanying manner –


You can utilize the above order in Unix/Linux stages and get to realize the port number being utilized to associate with the MySQL server.


We can see that the worth of the port variable is 3306. This is the default worth of the MySQL port number.

In windows, the accompanying order is utilized to get to know the worth of MySQL port.

Mysql – u your_username – e “SHOW GLOBAL VARIABLES LIKE ‘PORT'”

Mysql information base is gotten to by various customers and clients and this prompts the production of numerous associations and meetings. Every one of these are upheld by MySQL that utilizes TCP/IP attachment, Named lines, or Unix attachments to associate with the organization. The far off associations are constantly made utilizing TCP/IP attachments and 3306 as the default port number of Mysql.

To actually look at the port of MySQL on our organization in Unix/Linux stages, we can utilize the accompanying order –

netstat – a |grep mysql;

it lets us know that there are 2 associated associations of MySQL and one association is tuning in. In the above order, netstat is utilized to show the situation with the net and – a represents every one of the associations while | administrator is accustomed to determining the channels and extra data. For our situation, we are utilizing grep that states to look with watchword “mysql” determined further.

Then again, you can utilize the accompanying order –

netstat – na |grep 3306;

In windows, you can utilize the accompanying question –

netstat – na | find “3306”

that will show all associations with 3306 port. The yield shows that the port with port number 3306 is tuning in at localhost location and utilizations TCP attachment and convention for association.

Read more: MySQL tutoring: what is it and how to use the system

Which port does MySQL use?

Of course, MySQL utilizes the port 3306. Notwithstanding, the port might have changed. From one perspective this can be utilized for security, then again it tends to be that the port has as of now been utilized by another application.

Is the MySQL port 3306 TCP or UDP?

The default MySQL port is TCP (Transmission Control Protocol).

The TCP convention is the most regularly utilized convention on the Internet. As opposed to the UDP convention, the information is checked for accuracy when sending and getting through the TCP convention. If portions of the transmission are lost, they will be sent once more.

The UDP convention might be quicker, however doesn’t actually take a look at the transmission for blunders. Lost information can’t be mentioned once more.

Read more: 5 plugins to add featured Image plugin

Is there a weakness in the MySQL port?

As a general rule, you shouldn’t open the MySQL port to the rest of the world. All things considered, it is prudent to interface with the server through a SSH passage and afterward use it to build up the MySQL association.

Applications like HeidiSQL or Datagrip support SSH burrow associations.

Assuming you actually need to permit access through the port, you ought to indicate that main chose IP addresses are permitted to get to it.

Changing the default port of MySQL

Presently, we will see where the default port of MySQL is designed and determined and how we can transform it to some other port we need. The data about the MySQL arrangements is put away inside the my.ini of my.cnf document. This document is available in the organizer where your data set is introduced. It is exceptionally simple to change the port. We should simply to change the settings of the document.

Contingent upon which MySQL server bundle is introduced on your machine the augmentation of the document might change however it will consistently be either ini or cnf with the name my or mysql.cnf or mysqld.cnf. For my situation, this record is situated here –


Read more: Error: MySQL shutdown unexpectedly? Here is how to fix

How might I observe the MySQL port with SQL?

The least demanding way of discovering the port is straightforwardly through SQL and your PhpMyAdmin Interface. To do this, you initially need to sign in and afterward open the SQL console.

mysql port by means of sql explanation

In the information field underneath, you would now be able to embed the accompanying SQL proclamation to show the port of your data set:

SHOW VARIABLES WHERE variable_name = ‘port’;

phpmyadmin sql port config

That is it. With this couple of steps, you have tracked down the port number of your MySQL data set.

How might I get the port of the MySQL data set inside Ubuntu utilizing the shell?

To do this, open a shell association with your server. You can utilize instruments like clay to do this. Thereafter, you just need to enter the accompanying order lines to show the MySQL port inside the control center:


Read more: FIXED “your php installation appears to be missing the mysql extension which is required by wordpress”

How to Connect to MySQL Server: Interfacing with MySQL Using the MySQL Command-Line Client

In the primary article of our series, we gave a point by point walkthrough laying out the parts of how to introduce MySQL Server on Windows. In this aide, we expand on the way that your MySQL server is going.

To interface with MySQL Server:

1. Find the MySQL Command-Line Client
MySQL server is normally introduced along with a control center customer for working with data sets. On Windows, you can observe the MySQL Command Line Client in the Start menu. Kindly note, that the customer is introduced in two adaptations – with the help for Unicode and without it.MySQL customer area

2. Run the customer
At the point when you run the MySQL Server Command-Line Client, the order brief window opens requesting that you enter a secret key.

3.Enter your secret word
Here, you really want to login to MySQL from the Command line by entering the secret key that was set for the root client during the MySQL establishment.

4. Get a rundown of information bases
Enter the show data sets order to get a rundown of information bases on our MySQL Server.

5. Make a data set
To make another data set, utilize the make information base order.

6. Select the information base you need to utilize
To associate with a particular MySQL information base, at the MySQL brief, type the utilization data set order and determine the name of the data set you need to utilize.

7. Make a table and supplement information
Utilize the make table and addition into orders to make a table in our data set and supplement information into it.

8. Complete the process of working with the MySQL Command-Line Client
To leave the MySQL customer, type quit at the brief and press Enter.

Read more: How to properly uninstall and remove wordpress website

Interfacing with MySQL Using dbForge Studio for MySQL

dbForge Studio for MySQL is a superior across the board MySQL GUI instrument, permitting you to create, oversee, and regulate MySQL information bases in the element rich climate. With dbForge Studio for MySQL, you can rapidly and effortlessly set up a distant data set association just as interface with your nearby server.

To interface with MySQL Server utilizing Studio for MySQL:

  1. Open the Database Connection Properties exchange confine one of the accompanying ways:
    click New Connection on the Database menu
    or then again
    click the New Connection button on the Connection toolbar.
  2. Select the association type in the Type box. There are two association types accessible: TCP/IP and Named pipe.
  3. Enter the host name in the Host box.
  4. For a TCP/IP association, enter the port data in the Port box. The default port number is 3306. For a Named pipe association, enter the line name in the Pipe box.
  5. Enter the login accreditations in the User and Password fields.
  6. In the Database field, type or select the name of the information base to which you need to associate.
  7. The Connection Name will be created consequently from the Host name. In any case, you can make an unmistakable name for your new association, whenever required.
  8. (Discretionary advance). You can click Advanced to design progressed association properties. On the Advanced tab, you can indicate Connection break and Execute break esteems in a moment or two. Here, you can likewise choose the Encoding type from a drop-down list and empower the Detect MySQL character set, Use pressure, and Keep association alive choices.
  9. (Discretionary advance). You can tap the Security tab to arrange security properties. On this tab, you can set up SSL or SSH security properties.
  10. (Discretionary advance). You can go to the HTTP tab, to arrange HTTP burrow properties.
  11. (Discretionary advance). Snap Test Connection to confirm that you can get to MySQL Server utilizing the association data you’ve determined.
  12. Snap OK to make the association.

As should be obvious, dbForge Studio for MySQL offers a visual and direct strategy to interface with MySQL Server. It additionally gives you more command over association designs.

Read more: What is the difference between: SQL vs TSQL

Associating with MySQL Using MySQL Workbench

MySQL Workbench is a famous bound together visual apparatus for data set modelers, engineers, and DBAs.

To get to MySQL Server utilizing Workbench:

  1. Run MySQL Workbench.
  2. On the Database menu, click Connect to Database.
    On the other hand, click the in addition to symbol close to MySQL Connections mark.
  3. In the Connect to Database window that shows up, indicate the Connection name just as give the host name, port, and client esteems.
  4. (Discretionary advance). Go to the SSL tab to design SSL association settings.
  5. (Discretionary advance). Go to the Advanced tab to design progressed association settings.
  6. Alternatively, you can click Test Connection to check the boundaries that you’ve entered. In the event that you are certain that every one of the qualifications are right, click OK.
  7. Enter a secret phrase.
  8. On the off chance that you’ve effectively associated with MySQL Server, you will see a rundown of information bases on the left.

Read more: Syntax error in WordPress: How to fix

Create and connect to a MySQL database

instructions to establish a climate to run your MySQL information base (we consider this climate an occurrence ), associate it to your data set, and erase the DB occasion. To do this interaction, we will utilize Amazon Relational Database Service (Amazon RDS) . Every one of the assets we use in this instructional exercise are qualified for the Free Tier .

At the point when you click here , the AWS Management Console will open in another program window so you can keep this bit by bit guide open. At the point when this screen loads, look for RDS in Database and snap to open the Amazon RDS console.

Stage 1: Create a MySQL DB Instance

In this progression, we will utilize Amazon RDS to make a MySQL DB occurrence with a DB example of class db.t2.micro, 20 GB of capacity, and computerized reinforcements empowered with a maintenance time of one day. Recollect that all of this incorporates the option to utilize a complementary plan .

a. In the upper right corner of the Amazon RDS console, select the locale where you need to make the DB occurrence.

Note : AWS cloud assets are facilitated in exceptionally accessible server farms in various regions of the planet. Every area contains a few unique areas called Availability Zones. You can pick in what district you need to have your Amazon RDS action.


(Snap to grow).

b. In the Create information base area , select Create data set .

c. You presently have a few motor choices. For this instructional exercise, click the MySQL symbol, select Only empower choices qualified for RDS Free Usage Tier, and afterward click Next .

d. Presently you want to design your DB occurrence. The accompanying rundown shows an illustration of the design that you can use for this instructional exercise:

Occasion determinations :

  • Permitting Model : Select the default General Public License to utilize the General License Agreement for MySQL. MySQL has just one permitting model.
  • Information base Engine Version – Select the default MySQL adaptation. Note that Amazon RDS upholds various forms of MySQL in specific areas.
  • Class data set occasion : select db.t2.micro – – 1vCPU 1 GIB RAM . That compares to 1GB of memory and 1 vCPU. For a rundown of upheld occasion classes, see Amazon RDS item subtleties .
  • Multi-AZ Deployment : Please note that Multi-AZ arrangements bring about an expense. Utilizing a Multi-AZ sending will naturally arrangement and keep a coordinated backup imitation in an alternate Availability Zone. For more data, see Implementing High Availability .
  • Capacity Type – Select General Purpose ( SSD). For more data about capacity, see Storage for Amazon RDS .
  • Distributed capacity : select the default worth of 20 to apportion 20 GB of capacity to your information base. You can increase to a limit of 16 TB with Amazon RDS for MySQL.
  • Empower stockpiling autoscaling – If your responsibility is repetitive or eccentric, you should empower capacity autoscaling to permit RDS to naturally scale your capacity when required. This choice doesn’t matter to this instructional exercise.

Setup :

  • DB Instances Identifier – Enter a name for the DB Instance that is extraordinary to your record in the district you chose. In this instructional exercise, we will pick the name rds-mysql-10minTutorial .
  • Expert Username – Enter the username that you will use to sign into your DB occurrence. In this model, we will utilize masterUsername .
  • Expert Password : Enter a secret phrase that contains somewhere in the range of 8 and 41 printable ASCII characters (barring/, “, and @) for the expert client’s secret phrase.
  • confirm password : retype the secret key.
  • Apportioned capacity : enter 5 to distribute 5 GB of capacity for your data set. For more data about capacity assignment, see Amazon Relational Database Service Features (Change Order, Your Post Storage Type)

Click (Next).

also, You are currently on the Configure Advanced Settings page , where you can give extra data that RDS needs to send the MySQL DB case. The accompanying rundown shows the design of our model DB example.

Organization and security

  • Virtual Private Cloud (VPC ) – Select Default VPC . For more data on VPCs, see Amazon RDS and Amazon Virtual Private Cloud (VPC) .
  • Subnet bunch : Choose the default subnet bunch . For more data on subnet gatherings, see Working with data set subnet gatherings .
  • Public accessibliity – Select Yes . An IP address will be relegated for your DB occurrence so you can interface straightforwardly to the DB from your own gadget.
  • Accessibility zone – Choose No Preference. For more data, see Regions and Availability Zones .
  • VPC security gatherings – Select Create new VPC security bunch . A security gathering will be made that will permit the association of the IP address of the gadget you are presently utilizing to the data set made.

Information base choices


This choice isn’t accessible in the complementary plan. For more data, see Amazon RDS Resource Encryption .

Reinforcement duplicate

  • Reinforcement maintenance period: you can pick the quantity of days the reinforcement you make is held. For this instructional exercise, pick the worth 1 day.
  • Reinforcement window: select the default, No Preference .


Execution data

Select Disable Performance Insights for this instructional exercise.


  • Programmed minor form redesign – Select Enable auto minor variant move up to get programmed refreshes when accessible.
  • Upkeep window: select No Preference.

Security against cancellations

Eliminate Enable cancellation security for this instructional exercise. At the point when this choice is empowered, you can’t drop the data set.

Click Create database.

F. Your DB occasion is being made. Snap View Your DB Instances .

Note : Depending on the DB Instance class and apportioned stockpiling, the new DB Instance could require a few minutes to open up.

The new DB occasion shows up in the rundown of DB examples in the RDS console. The DB occasion will be in the making state until it is made and prepared to utilize. At the point when the status changes to accessible , you will actually want to interface with an information base on the DB occasion.

Assuming you need, you can continue to the following stage while you trust that the DB example will open up.

Stage 2: Download a SQL customer

After the DB occasion has been made and is in the “accessible” state, you can interface with an information base on the DB occurrence with any standard SQL customer. In this progression, we will download MySQL Workbench, which is a famous SQL customer.

a. Go to the Download MySQL Workbench page to download and introduce MySQL Workbench. For more data on utilizing MySQL, see the MySQL documentation .

Note : Remember to run MySQL Workbench on a similar gadget with which you made the DB case. The security bunch in which your information base is found is designed to just permit the association of the gadget on which you made the data set occasion.

b. You will be inquired as to whether you need to sign in, register, or start the download. You can click No much appreciated, simply start my download to download rapidly.

Stage 3: Connect to the MySQL data set

In this progression, we will interface with the data set that you made with MySQL Workbench.

a. Dispatch the MySQL Workbench application and go to Database> Connect to Database (Ctrl + U) from the menu bar.

b. A discourse box will show up. Compose the accompanying:

  • Hostname: You can find your hostname in the Amazon RDS console, as displayed in the picture to one side.
  • Port – The default ought to be 3306.
  • Username – Enter the username that you made for the Amazon RDS information base. In this instructional exercise, it is ” masterUsername “.
  • Secret key : Click Store in Vault (or Store in Keychain on MacOS) and enter the secret word you utilized while making the Amazon RDS information base.

Click OK .

c. You have effectively associated with the information base! In MySQL Workbench, you will see different blueprint objects accessible in the information base. Presently you can begin making tables, entering information, and questioning.

Stage 4: Delete the DB Instance

You can without much of a stretch eliminate the MySQL DB occasion from the Amazon RDS console. It is suggested that you erase the occasions that you at this point don’t utilize so you are not generally charged for them.

a. Return to the Amazon RDS console. Select Databases , pick the example you need to erase, and afterward select Delete from the Actions drop-down menu .

b. You should make a last picture catch and affirm the cancellation. In our model, don’t make a last picture catch, affirm that you need to erase the occurrence, and afterward click Delete.

Note : Removing the DB occasion might require a couple of moments.



For website maintenance service contact us.

Share this Article
Posted by Rebecca
Rebecca is an Independent content writer for breldigital, She writes content on any given topic. She loves to write a case study article or reviews on a brand, Be it any topic, she nails it
Leave a comment

Leave a Reply