Linux下如何查看MySQL端口
MySQL的端口默认为3306,但是在安装过程中有可能修改了MySQL端口。
1、登录mysql
[root@localhost ~]# mysql -uroot -pEnter password: 输入数据库密码;
2、使用show global variables like & lsquo; port& rsquo; ; 命令查看端口号,
mysql> show global variables like & lsquo; port& rsquo; ; +& mdash; & mdash; & mdash; & mdash; & mdash; +& mdash; & mdash; -+| Variable_name | Value |+& mdash; & mdash; & mdash; & mdash; & mdash; +& mdash; & mdash; -+| port | 3306 |+& mdash; & mdash; & mdash; & mdash; & mdash; +& mdash; & mdash; -+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端口”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注行业资讯频道。
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: Linux下如何查看MySQL端口
本文地址: https://pptw.com/jishu/9149.html