MySQL“服务器正在运行”

MySQL“服务器正在运行”

MySQL 服务器运行良好,但突然断线了,我无法从 WorkBench 连接到它。

#sudo service mysql status
● mysql.service - MySQL Community Server
 Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
 Active: active (running) since Wed 2023-04-19 08:18:38 EEST; 57min ago
 Process: 760 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 940 (mysqld)
    Status: "Server is operational"
    Tasks: 39 (limit: 9433)
    Memory: 436.7M
    CPU: 9.452s
    CGroup: /system.slice/mysql.service
         └─940 /usr/sbin/mysqld

守护进程正在运行

#ps xa | grep mysqld
   940 ?        Ssl    0:11 /usr/sbin/mysqld
   13439 pts/1    S+     0:00 grep --color=auto mysqld

港口开通

 #sudo ss -tap | grep mysql

    LISTEN   0      151         192.168.0.3:mysql         0.0.0.0:*     users:(("mysqld",pid=940,fd=33))                                                                                                                             
    LISTEN   0      70          192.168.0.3:33060         0.0.0.0:*     users:(("mysqld",pid=940,fd=31))    

日志中没有特殊警告,只有普通消息

#sudo journalctl -u mysql
 [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.32-0ubuntu0.22.04.2>
 [MY-013576] [InnoDB] InnoDB initialization has started.
 [MY-013577] [InnoDB] InnoDB initialization has ended.
 [MY-010068] [Server] CA certificate ca.pem is self signed.
 [MY-013602] [Server] Channel mysql_main configured to support TLS. En>
 [MY-011323] [Server] X Plugin ready for connections. Bind-address: ':>
 [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version>   

MySQL 版本

 #mysqladmin version
  mysqladmin  Ver 8.0.32-0ubuntu0.22.04.2 for Linux on x86_64 ((Ubuntu))
  Copyright (c) 2000, 2023, Oracle and/or its affiliates.
  Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
  Server version          8.0.32-0ubuntu0.22.04.2
  Protocol version        10
  Connection              Localhost via UNIX socket
  UNIX socket             /var/run/mysqld/mysqld.sock
  Uptime:                 1 hour 8 min 42 sec
  Threads: 2  Questions: 8  Slow queries: 0  Opens: 136  Flush tables: 3  Open tables: 55  Queries per second avg: 0.001

但连接是不可能的

#mysqladmin -h `hostname` --port=3306 version
   mysqladmin: connect to server at 'php-desktop' failed
   error: 'Can't connect to MySQL server on 'php-desktop:3306' (111)'
   Check that mysqld is running on php-desktop and that the port is 3306.
   You can check this by doing 'telnet php-desktop 3306'

发生了什么事以及如何修复与服务器的连接?

相关内容