1. 登录mysql

[root@test /]# mysql -u root -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)

3. 修改端口,

编辑/etc/my.cnf文件,早期版本有可能是my.conf文件名,增加端口参数,并且设定端口,注意该端口未被使用,保存退出。

[root@test etc]# vi my.cnf
[mysqld]
port=3506
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

“my.cnf” 11L, 261C written
[root@test etc]#

4. 重新启动mysql

[root@test ~]# systemctl restart mysqld

5.再次登录后检查端口已修改为’3506’.

[root@test etc]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.1.66 Source distribution

Copyright © 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.

mysql> show global variables like ‘port’;
±--------------±------+
| Variable_name | Value |
±--------------±------+
| port | 3506 |
±--------------±------+
1 row in set (0.00 sec)

mysql>

1. 登录mysql

[root@test /]# mysql -u root -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)

3. 修改端口,

编辑/etc/my.cnf文件,早期版本有可能是my.conf文件名,增加端口参数,并且设定端口,注意该端口未被使用,保存退出。

[root@test etc]# vi my.cnf
[mysqld]
port=3506
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

“my.cnf” 11L, 261C written
[root@test etc]#

4. 重新启动mysql

[root@test ~]# systemctl restart mysqld

5.再次登录后检查端口已修改为’3506’.

[root@test etc]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.1.66 Source distribution

Copyright © 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.

mysql> show global variables like ‘port’;
±--------------±------+
| Variable_name | Value |
±--------------±------+
| port | 3506 |
±--------------±------+
1 row in set (0.00 sec)

mysql>

MySql修改默认端口相关推荐

  1. centos mysql 端口_Linux CentOS Mysql修改默认端口

    为了提高服务器的安全性,本节课主要讲的是Linux下如何修改Mysql端口.支持Linux环境下大部分系统的修改,如Centos和Ubuntu等. 演示环境: Linux CentOS 6.3 X32 ...

  2. linux mysql端口启动失败怎么办,Linux下apache mysql等服务修改默认端口后无法正常启动解决办法...

    Linux下apache mysql等服务修改默认端口后无法正常启动解决办法 linux下 apache 等服务修改默认端口后无法正常启动解决办法 服务器上装了两个webserver,一个是nginx ...

  3. linux修改mysql的默认端口

    本文是基于centos7的环境进行编写,如果是其他linux系统命令可能不一样 1.首先我们查看mysql的默认端口 我们登录mysql到mysql查看mysql使用的端口 show global v ...

  4. CentOS Tomcat6 修改默认端口8080为80

    CentOS Tomcat6 修改默认端口8080为80 By 14 | Published 2012/11/07 修改tomcat的端口,在conf目录里的server.xml文件 1 <Co ...

  5. 如何在Spring boot中修改默认端口

    文章目录 介绍 使用Property文件 在程序中指定 使用命令行参数 值生效的顺序 如何在Spring boot中修改默认端口 介绍 Spring boot为应用程序提供了很多属性的默认值.但是有时 ...

  6. hexo修改默认端口

    hexo修改默认端口 默认使用4000端口,用hexo s -p 80 ,可以暂时修改启动端口. 但是每次启动都要写"-p 80"才行,过于繁琐. 修改方法: 找到node_mod ...

  7. Linux部署Tomcat踩的坑以及解决方案【8080无法访问、日志显示XX端口被占用、修改默认端口、无法提供安全连接】

    Linux部署Tomcat踩的坑以及解决方案[8080无法访问.日志显示XX端口被占用.修改默认端口.无法提供安全连接] 8080无法访问 解压开压缩包后,执行bin目录下的 startup.sh 后 ...

  8. Jetty修改默认端口

    Jetty修改默认端口 本机上8080端口被占用了,而jetty的默认端口就是8080 打开\jetty-9.3.13.M0\jetty-distribution-9.3.13.M0下的start.i ...

  9. centos8系统influxdb2修改默认端口8086

    centos8系统influxdb2修改默认端口8086 1.修改配置文件/etc/influxdb/config.toml 添加修改,把8086默认端口修改为8099 http-bind-addre ...

  10. 战神引擎架设php,战神引擎免GGTools验证,免PHPStudy 通用版本搭建教程+修改默认端口+100%进游戏...

    战神引擎免GGTools验证,免PHPStudy 通用版本搭建教程+修改默认端口+100%进游戏 说明 有人说谁谁的教程才2,30块钱 贵有贵的道理,需要就买,没人强迫你. 保你能顺利进游戏 100% ...

最新文章

  1. 人脸识别引擎SeetaFaceEngine中Detection模块使用的测试代码
  2. 动态加载jar 并进行调用
  3. Oracle条件查询语句-where
  4. 中西医与算法之间的联系
  5. Linux设备中的并发控制
  6. 浅谈C中的malloc和free\\感谢lj_860603,工作了,没时间验证了,觉得挺好的,转载了...
  7. 【优化算法】多目标水循环算法(MOWCA)【含Matlab源码 1433期】
  8. C#集成FastDFS断点续传
  9. 小黑与Vista试用手记
  10. 解决端口占用问题 Port xxxx was already in use
  11. linux虚拟内存满了怎么办,解决linux虚拟内存不够用的方法
  12. 实战开发支付SDK —— 对接微信支付看这一篇文章就够啦(含源码)
  13. 终端 常用移动光标的快捷键
  14. HTML 动态夜空特效
  15. 理解C语言中的a++、a--和++a、--a
  16. Vue-router:二级路由跳转另一条路由下的子级
  17. 如何把HTML转换成动图,视频转gif 如何将视频制作gif动画图片
  18. 打不开计算机 在任务栏里显示,电脑下方的任务栏不显示怎么办 电脑任务栏不显示解决方法【图文】...
  19. 六子棋的程序(修改)
  20. peda的帮助文档(自己翻译)

热门文章

  1. 移动网速测试软件,网速测试大师APP
  2. php pager,fleaphp常用方法分页之Pager使用方法
  3. Unix文件系统基本概述
  4. 计算机键盘功能教案,认识键盘教学设计
  5. 顶级分区软件Acronis Disk Director 11最新版官方下载
  6. Java分布式二手房项目尚好房第二课 用户角色管理
  7. Excel实现电子发票管理
  8. python工时计算_七兮网络-如何根据考勤数据自动计算出员工工作时间
  9. 自学-Linux-老男孩Linux77期-day6
  10. [HTTP权威指南]2.HTTP连接管理