共計 745 個字符,預計需要花費 2 分鐘才能閱讀完成。
本文丸趣 TV 小編為大家詳細介紹“Linux 下如何查看 MySQL 端口”,內容詳細,步驟清晰,細節處理妥當,希望這篇“Linux 下如何查看 MySQL 端口”文章能幫助大家解決疑惑,下面跟著丸趣 TV 小編的思路慢慢深入,一起來學習新知識吧。
MySQL 的端口默認為 3306,但是在安裝過程中有可能修改了 MySQL 端口。
1、登錄 mysql
[root@localhost ~]# mysql -uroot -pEnter password: 輸入數據庫密碼;
2、使用 show global variables like lsquo;port rsquo;; 命令查看端口號,
mysql show global variables like lsquo;port rsquo;;+ mdash; mdash; mdash; mdash; mdash;+ mdash; mdash;-+| Variable_name | Value |+ mdash; mdash; mdash; mdash; mdash;+ mdash; mdash;-+| port | 3306 |+ mdash; mdash; mdash; mdash; mdash;+ mdash; mdash;-+1 row in set (0.00 sec)
mysql
3306 即為端口號。
二、mysql 端口號的修改
1、編輯 /etc/my.cnf 文件 [root@localhost ~]# vi /etc/my.cnf
2、添加 port=2032;
3、重啟 mysql [root@localhost ~]# /etc/init.d/mysqld restart
讀到這里,這篇“Linux 下如何查看 MySQL 端口”文章已經介紹完畢,想要掌握這篇文章的知識點還需要大家自己動手實踐使用過才能領會,如果想了解更多相關內容的文章,歡迎關注丸趣 TV 行業資訊頻道。