精华内容
下载资源
问答
  • linux下修改mysql端口号

    千次阅读 2018-03-27 16:24:42
    查看当前端口号 show global variables like 'port';  3.修改端口:编辑/etc/my.cnf文件 vi /etc/my.cnf  4. 增加或修改端口参数,然后保存退出  [mysqld] port=3308log-bin=mysql-binserver-id=2max_...

    1.登录mysql

    mysql -u root -p

     2.查看当前端口号

    show global variables like 'port';

     3.修改端口:编辑/etc/my.cnf文件

    vi /etc/my.cnf

     4. 增加或修改端口参数,然后保存退出

     [mysqld]

    port=3308
    log-bin=mysql-bin
    server-id=2
    max_allowed_packet=10M
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    # Settings user and group are ignored when systemd is used.
    # If you need to run mysqld under a different user or group,
    # customize your systemd unit file for mariadb according to the
    # instructions in http://fedoraproject.org/wiki/Systemd

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

    #
    # include all files from the config directory
    #
    !includedir /etc/my.cnf.d
    5.重启mysql

    service mysqld restart

     

    展开全文
  • 一、查看默认端口号1、登录mysql[[emailprotected] ~]# mysql -uroot -pEnter password: 输入数据库密码;...命令查看端口号,mysql> show global variables like ‘port‘;+---------------+-------+| Var...

    7cb2767735cb120652ba90133f6ac927.png

    一、查看默认端口号

    1、登录mysql

    [[email protected] ~]# 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文件  [[email protected] ~]# vi /etc/my.cnf

    2、添加port=2032;

    3、重启mysql [[email protected] ~]# /etc/init.d/mysqld restart

    --------------------- 本文来自 此刻的丶 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/b551500/article/details/79677655?utm_source=copy

    linux mysql 端口号修改

    展开全文
  • linux 修改mysql端口

    千次阅读 2017-07-13 09:58:38
    mysql更改端口 修改/etc/my.cnf 添加port=3399 修改后如下 [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock port=3308 user=mysql # Disabling symbolic-links is recommended to ...

    mysql更改端口
    修改/etc/my.cnf
    添加port=3399
    修改后如下
    [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

    [root@mysql ~]# service mysql restart


    错误解决:

    [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

    /usr/sbin/setenforce 0


    修改l端口报错解决:

    Can't start server: Bind on TCP/IP port: Permission denied

    修改: vi /etc/selinux/config

    SELINUX=disabled

    重启服务器即可

    展开全文
  • Linux下面修改Mysql端口号 一、登录mysql [root@test /]# mysql -u root -p Enter password: 你的密码 二、使用命令show global variables like ‘port’;查看端口号 mysql> show global variables like ‘port...

    Linux下面修改Mysql的端口号

    一、登录mysql
    [root@test /]# mysql -u root -p
    Enter password: 你的密码

    二、使用命令show global variables like ‘port’;查看端口号
    mysql> show global variables like ‘port’;
    ±--------------±------+
    | Variable_name | Value |
    ±--------------±------+
    | port | 3306 |
    ±--------------±------+
    1 row in set (0.00 sec)

    三、修改端口,编辑/etc/my.cnf文件
    [root@test etc]# vi my.cnf
    [mysqld]
    port=要改的端口
    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]#

    四、重新启动mysql (很重要)
    [root@test ~]# /etc/init.d/mysqld restart 或 service mysql restart
    Stopping mysqld: [ OK ]
    Starting mysqld: [ OK ]

    五、再次登录后检查端口已修改为“你的端口"
    [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 | 你的端口"|
    ±--------------±------+
    1 row in set (0.00 sec)

    mysql>

    展开全文
  • 这算是个小小的踩坑吧 在linux下修改端口号一定要先把mysql服务关闭,然后再修改端口号, 否则就会使用数据库连接软件怎么连怎么行,项目就是连不上,也获取不到连接 还好我弄了快照,回滚回去了,难顶 ...
  • Linux下修改mysql的默认端口号

    千次阅读 2019-10-26 17:51:59
    1. 登录mysql [root@test /]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 92 Server version: 5.1.66 Source distribution ...
  • 一、查看默认端口号 1、登录mysql [root@localhost ~]# mysql -uroot -p Enter password: 输入数据库密码; 2、使用show global variables like ‘port’; 命令查看端口号, mysql> show global variables like ...
  • 一、查看默认端口号 登录mysql mysql -uroot -p 使用showglobalvariableslike'port'; 命令查看端口号, mysql> show global variables like 'port'; +---------------+-------+ | Variable_name | Value | +...
  • Linux环境下修改MySQL端口方法

    千次阅读 2017-02-23 16:46:38
    Linux环境下修改MySQL端口方法: [mysqld] port = 3306 #修改为你想要改的端口 vi /etc/my.cnf datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock [mysql.server] user=mysql basedir=/...
  • mysql 服务器默认是3306。 修改修改/etc/my.cnf文件。 如果没有,如果内存小于128M,则复制my-small.cnf,重新命名为:my.cnf; 如果内存小于512M,则复制my-medium.cnf,重新命名为:my.cnf; 如果内存小于1G,则...
  • 如何查看mysql默认端口号修改端口号2015-03-1917:42:18 1.登录mysql [root@test/]#mysql-uroot-p Enterpassword: 2.使用命令showglobalvariableslike'port';查看端口号 mysql&...
  • 1.登录Mysql [root@test /]# mysql -u root -p ...2.使用命令查看端口号 mysql> show global variables like 'port'; +---------------+-------+ | Variable_name | Value | +---------------+-----...
  • 查看端口号: 1.登录mysqlmysql -u root -p ... 2.show global ...1.linux下在/etc/my.cnf中修改,windows下则是在my.ini中修改 由于我用的windows,下面的操作都是windows下的。 2.windows下my.ini的位置 my.i.
  • 修改mysql 端口号

    2017-11-11 18:31:45
    运行环境: Oracle Linux Server release 6.4  mysql Ver 14.14 Distrib 5.1.66 1. 登录mysql [root@test /]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Co
  • linux 修改mysql默认端口3306

    千次阅读 2018-03-24 09:36:51
    linux 修改mysql默认端口3306cd /etc/mysql/my.cnf修改两处 客户端的port=3306 和mysqld的服务器端口port=3306 [client] port=3306 [mysqld] port=3306 重启mysql服务器即可sudo service mysql restart...
  • Linux环境下修改MySQL端口方法:

    万次阅读 2014-02-25 16:42:49
    Linux环境下修改MySQL端口方法: [mysqld] port = 3306 #修改为你想要改的端口 vi /etc/my.cnf datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock [mysql.server] user=mysql basedir=/var/lib [safe...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 62,098
精华内容 24,839
关键字:

linux修改mysql端口号

linux 订阅
mysql 订阅