We had to first log in as a superuser using the su command for both these commands. The command used to connect to the database server using its default port and root access is as follows – mysql -u rootīy specifying the particular port using which you want to establish the TCP/IP connection to the MySQL database server, you can use the following command – mysql -u root –port=3306 As we saw in the output of the above command, the 3306 port is listening. We can connect to our MySQL database server using the command-line terminal with the help of a TCP/IP protocol connection by connecting to a specific port that is listening to the network connections. The output indicates that the port with port number 3306 is listening at localhost 127.0.0.1 address and uses TCP socket and protocol for connection. That will display all connections with the 3306 port. In Windows, you can make use of the following query – netstat -na | find “3306” In our case, we “se gr”p, which states to search with the keyword “mysql” specified further.Īlternatively, you can use the following command – netstat -na |grep 3306 Furthermore, the “|” operator includes filters and supplementary information to define the output. The command employs the “netstat” utility to exhibit the network status, while the “-a” option instructs it to display all connections. That gives the following output in my case –Įxecuting the mentioned command reveals two active connections for MySQL, with one of them in a listening state. To check the port of MySQL on our network in Unix/Linux platforms, we can make use of the following command – netstat -a |grep mysql Remote connections to MySQL always utilize TCP/IP sockets, with the default port number being 3306. MySQL supports all these, which use TCP/IP sockets, Named pipes, or Unix sockets to connect with the network. Multiple clients and users access the Mysql database, leading to various connections and sessions. In Windows, you can use the following command to retrieve the value of the MySQL port: Mysql -u your_username -e "SHOW GLOBAL VARIABLES LIKE 'PORT'" This is the default value of the MySQL port number. We can see that the value of the port variable is 3306. You can use the above command in Unix/Linux platforms and learn the port number to connect to the MySQL server. When you are connected to the MySQL server and want to check the port your client is using to connect with the MySQL server, you can retrieve the value of the variable named port that stores the port number used for the connection. Additionally, it will explain how to modify the default port used for connecting to MySQL by making changes in the configuration file. This article will demonstrate retrieving the currently used ports, checking your MySQL port, and connecting with the MySQL database server using the default MySQL port. MySQL utilizes TCP/IP sockets to establish connections with remotely located clients. All these protocol values serve the purpose of establishing and maintaining connections to remote or local servers. There are four types of protocol values, namely, TCP, used in all operating systems PIPE and MEMORY, used in the Windows operating system and SOCKET, used in Unix/Linux operating systems. Hadoop, Data Science, Statistics & others
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |