mysql更改端口 修改/etc/my.cnf 添加port=3308 修改后如下 [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock port=3308 user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 default-character-set=utf8 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid 然后重启mysql 如果你开启了selinux,mysql会无法启动,你会在日志中看到以下错误 [ERROR] Can't start server: Bind on TCP/IP port: Permission denied [ERROR] Do you already have another mysqld server running on port: 3308 那么,你需要关掉selinux,不想重启服务器,而关掉selinux,使用以下命令 /usr/sbin/setenforce 0 修改linux下mysql端口时候报错: Can't start server: Bind on TCP/IP port: Permission denied 需要修改: vi /etc/selinux/config SELINUX=disabled 然后重启服务器即可 (责任编辑:IT) |