MySQL view and modify the default port number

Source: Internet
Author: User
Tags mysql view

1. Log in to MySQL[email protected]/]# mysql-u root-pEnter Password:Welcome to the MySQL Monitor. Commands End With; or \g.Your MySQL Connection ID isServer version:5.1.66 Source distribution Copyright (c), Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of the Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement. mysql> 
2. Use the command show global variables like ' port '; View port number  Mysql> show global variables like ' port ', +---------------+-------+| variable_name | Value |+---------------+-------+| Port | 3306 |+---------------+-------+1 row in Set (0.00 sec)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.  [Email protected] etc]# VI my.cnf[mysqld]port=3506datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql # Disabling Symbolic-links is recommended to prevent assorted security riskssymbolic-links=0 [Mysqld_safe]log-error=/var /log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid "My.cnf" 11L, 261C written[[email protected] etc]# 4. Restart MySQL[Email protected] ~]#/etc/init.d/mysqld restartstopping mysqld: [OK]starting mysqld: [OK] 
5. After logging in again, check that the port has been modified to ' 3506 '.  [Email protected] etc]# mysql-u root-penter password:welcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 2Server version:5.1.66 Source distribution Copyright (c) #, Oracle and/or its Affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement. Mysql> show global variables like ' port ', +---------------+-------+| variable_name | Value |+---------------+-------+| Port | 3506 |+---------------+-------+1 row in Set (0.00 sec) mysql>

MySQL view and modify the default port number

Related Article

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.