改动MySQL数据库port号 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 FilesMySQLMySQL Server 5.5my.ini

[mysqld]

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

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


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

原文地址:https://www.cnblogs.com/blfbuaa/p/6752934.html