一、查看默认端口号
1、登录mysql
[root@localhost ~]# mysql -uroot -p
Enter password: 输入数据库密码;
2、使用show global variables like 'port'; 命令查看端口号,
mysql> show global variables like 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
1 row in set (0.00 sec)
mysql>
3306即为端口号。
二、mysql端口号的修改
1、编辑/etc/my.cnf文件 [root@localhost ~]# vi /etc/my.cnf
2、添加port=2032;
3、重启mysql [root@localhost ~]# /etc/init.d/mysqld restart
最后
以上就是威武夕阳最近收集整理的关于linux下mysql 查看默认端口号与修改端口号方法的全部内容,更多相关linux下mysql内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复