cent7.0 MySQL Modify port

Source: Internet
Author: User

  1. How to view MySQL default port number and modify port number 2015-03-19 17:42:18
  2. 1. Log in to MySQL
  3. [Email protected]/]# mysql-u root-p
  4. Enter Password:
  5. 2. Use the command show global variables like ' port '; View port number
  6. MySQL> show global variables like ' port ';
  7. +---------------+-------+
  8. | variable_name | Value |
  9. +---------------+-------+
  10. | Port | 3306 |
  11. +---------------+-------+
  12. 1 row in Set (0.00 sec)
  13. 3. Modify the port, edit the/etc/my.cnf file, the earlier version may be the my.conf file name, add the port parameter, and set the port, note that the port is not used, save exit.
  14. [Email protected] etc]# VI my.cnf
  15. [Mysqld]
  16. port=3506
  17. Datadir=/var/lib/mysql
  18. Socket=/var/lib/mysql/mysql.sock
  19. user=MySQL
  20. # Disabling Symbolic-links is recommended to prevent assorted security risks
  21. symbolic-links=0
  22. [Mysqld_safe]
  23. Log-error=/var/log/mysqld.log
  24. Pid-file=/var/run/mysqld/mysqld.pid
  25. "My.cnf" 11L, 261C written
  26. [Email protected] etc]#
  27. 4. Restart MySQL
  28. [Email protected] ~]#/etc/init.d/mysqld restart
  29. Stopping mysqld: [OK]
  30. Starting mysqld: [OK]
  31. 5. After logging in again, check that the port has been modified to ' 3506 '.
  32. [Email protected] etc]# mysql-u root-p
  33. Enter Password:
  34. Welcome to the MySQL Monitor. Commands End With; or \g.
  35. Your MySQL Connection ID is 2
  36. Server version:5.1.66 Source Distribution
  37. Copyright (c), Oracle and/or its affiliates. All rights reserved.
  38. Oracle is a registered trademark of the Oracle Corporation and/or its
  39. Affiliates. Other names trademarks of their respective
  40. Owners.
  41. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
  42. MySQL> show global variables like ' port ';
  43. +---------------+-------+
  44. | variable_name | Value |
  45. +---------------+-------+
  46. | Port | 3506 |
  47. +---------------+-------+
  48. 1 row in Set (0.00 sec)
  49. MySQL>
  50. Summary: Note that the modified port should not be occupied, and planning, do not light always adjust the database port. There is security, remember with the person responsible for the network advance notice, so that the port can not be used properly.

cent7.0 MySQL Modify port

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.