cent7.0 mysql 修改連接埠

來源:互聯網
上載者:User

標籤:注意   就是   other   oracl   ini   佔用   提前   spec   調整   

  1. 如何查看mysql 預設連接埠號碼和修改連接埠號碼 2015-03-19 17:42:18  
  2.   
  3.   
  4. 1. 登入mysql  
  5.   
  6. [[email protected] /]# mysql -u root -p  
  7. Enter password:  
  8.   
  9.   
  10. 2. 使用命令show global variables like ‘port‘;查看連接埠號碼  
  11.   
  12. mysql> show global variables like ‘port‘;  
  13. +---------------+-------+  
  14. | Variable_name | Value |  
  15. +---------------+-------+  
  16. | port | 3306 |  
  17. +---------------+-------+  
  18. 1 row in set (0.00 sec)  
  19.   
  20.   
  21. 3. 修改連接埠,編輯/etc/my.cnf檔案,早期版本有可能是my.conf檔案名稱,增加連接埠參數,並且設定連接埠,注意該連接埠未被使用,儲存退出。  
  22.   
  23. [[email protected] etc]# vi my.cnf  
  24. [mysqld]  
  25. port=3506  
  26. datadir=/var/lib/mysql  
  27. socket=/var/lib/mysql/mysql.sock  
  28. user=mysql  
  29. # Disabling symbolic-links is recommended to prevent assorted security risks  
  30. symbolic-links=0  
  31.   
  32. [mysqld_safe]  
  33. log-error=/var/log/mysqld.log  
  34. pid-file=/var/run/mysqld/mysqld.pid  
  35.   
  36. "my.cnf" 11L, 261C written  
  37. [[email protected] etc]#  
  38.   
  39. 4. 重新啟動mysql  
  40.   
  41. [[email protected] ~]# /etc/init.d/mysqld restart  
  42. Stopping mysqld: [ OK ]  
  43. Starting mysqld: [ OK ]  
  44.   
  45. 5.再次登入後檢查連接埠已修改為’3506’.  
  46.   
  47. [[email protected] etc]# mysql -u root -p  
  48. Enter password:  
  49. Welcome to the MySQL monitor. Commands end with ; or \g.  
  50. Your MySQL connection id is 2  
  51. Server version: 5.1.66 Source distribution  
  52.   
  53. Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.  
  54.   
  55. Oracle is a registered trademark of Oracle Corporation and/or its  
  56. affiliates. Other names may be trademarks of their respective  
  57. owners.  
  58.   
  59. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.  
  60.   
  61. mysql> show global variables like ‘port‘;  
  62. +---------------+-------+  
  63. | Variable_name | Value |  
  64. +---------------+-------+  
  65. | port | 3506 |  
  66. +---------------+-------+  
  67. 1 row in set (0.00 sec)  
  68.   
  69. mysql>  
  70.   
  71. 總結:注意修改的連接埠不要被佔用,而且要有規劃,不要輕意的總是調整資料庫連接埠。還有就是安全保障,記得與負責網路的人提前通知,以免連接埠無法正常使用。  

cent7.0 mysql 修改連接埠

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.