How To Change MySQL Port Number On Linux Debian 11.3
- 00:25 lsb_release -a
- 00:35 mysql -u root -p
- 01:09 select @@port;
- 01:25 \q
- 01:33 cd /etc/mysql/mysql.conf.d/
- 02:00 nano mysqld.cnf
- 02:30 systemctl restart mysql.service
- 02:45 mysql -u root -p
- 03:03 select @@port;
- 03:21 \q
- 03:38 nano mysqld.cnf
- 03:55 systemctl restart mysql.service
- 04:13 mysql -u root -p
- 04:28 select @@port;
- 04:44 \q
To Change MySQL Port Number On Linux Debian 11.3
Introduction:
MySQL is an open-source relational database management system. For WordPress sites, that means it helps you store all your blog posts, users, plugin information and etc.
Installation Procedure:
Step 1: To check the OS version by using the following command
root@linuxhelp: ~# lsb_release -a
Step 2: Getting into the MySQL shell by using the below command
root@linuxhelp:~# mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.28-0ubuntu0.20.04.3 (Ubuntu)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Step 3: Check the port number by using the below command
mysql> select @@port;
+--------+
| @@port |
+--------+
| 3306 |
+--------+
1 row in set (0.00 sec)
Step 4: Quit the MySQL shell by using the below command
mysql> \q
Bye
Step 5: Enter into the Configuration directory by using the below command
root@linuxhelp:~# cd /etc/mysql/mysql.conf.d/
Step 6: List the files by using the below command
root@linuxhelp:/etc/mysql/mysql.conf.d# ls -la
total 20
drwxr-xr-x 2 root root 4096 Feb 22 03:47 .
drwxr-xr-x 4 root root 4096 Feb 22 01:29 ..
-rw-r--r-- 1 root root 132 Feb 22 00:59 mysql.cnf
-rw-r--r-- 1 root root 2220 Feb 22 03:47 mysqld.cnf
-rw-r--r-- 1 root root 2219 Feb 22 01:29 mysqld.cnf.save
Step 7: Edit the mysqld.cnf Configuraion file by using the below command
root@linuxhelp:/etc/mysql/mysql.conf.d# nano mysqld.cnf
#The MySQL database server configuration file.
#One can use all long options that the program supports.
#Run program with --help to get a list of available options and with
#--print-defaults to see which it would actually understand and use.
#For explanations see
#http://dev.mysql.com/doc/mysql/en/server-system-variables.html
#Here is entries for some specific programs
#The following values assume you have at least 32M ram
[mysqld]#
#*Basic Settings#
#pid-file = /var/run/mysqld/mysqld.pid
#socket = /var/run/mysqld/mysqld.sock
user = mysql
port = 3344
Step 8: Restart the MySQL service by using the below command
root@linuxhelp:/etc/mysql/mysql.conf.d# systemctl restart mysql.service
Step 9: Enter into the MySQL shell by using the below command
root@linuxhelp:/etc/mysql/mysql.conf.d# mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.28-0ubuntu0.20.04.3 (Ubuntu)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Step 10: Check the port number by using the below command
mysql> select @@port;
+--------+
| @@port |
+--------+
| 3344 |
+--------+
1 row in set (0.00 sec)
mysql> \q
Bye
Step 11: Edit the Configuration file by using the below command
root@linuxhelp:/etc/mysql/mysql.conf.d# nano mysqld.cnf
Step 12: Restart the MySQL service by using the below command
root@linuxhelp:/etc/mysql/mysql.conf.d# systemctl restart mysql.service
root@linuxhelp:/etc/mysql/mysql.conf.d# mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Step 13: Check the port by using the below command
mysql> select @@port;
+--------+
| @@port |
+--------+
| 3306 |
+--------+
1 row in set (0.00 sec)
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to change MySQL Port number On Linux Debian 11.3.Your feedback is much welcome.
Comments ( 0 )
No comments available