1、因为阿里云服务器认为3306端口为高危,所以将mysql默认的端口号改掉。
2、查看端口号
# cd /usr/local/mysql/bin
# ./mysql -uroot -p密码 //登录mysql
mysql> show global variables like 'port'; //查看端口号
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
1 row in set (0.01 sec)
3、mysql5.6修改端口号
vi my.cnf
//添加
[mysqld]
port=3308
[client]
port=3308
//拷贝纸etc目录下
cp my.cnf /etc
4、重启mysql服务
# service mysqld restart
5、再次查看端口号
mysql> show global variables like 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3308 |
+---------------+-------+
1 row in set (0.00 sec)
5、修改阿里云服务器控制台中的安全组规则,将3306端口换成3308端口