修改MySQL数据库端口号 2.0

这里通过修改数据库服务启动时的配置文件来达到修改的目的

Linux下的配置目录文件(示例):/usr/local/mysql/my.cnf

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = ....
port = 13306


Windows下的配置目录文件(示例):C:\Program Files\MySQL\MySQL Server 5.5\my.ini

[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=13306

先关闭数据库服务,修改配置文件,重启数据库服务


启动数据库服务,连接的时候就必须要通过13306来连接了,否则连不上

你可能感兴趣的:(MySQL)