gpt4 book ai didi

MySQL 无法启动?

转载 作者:行者123 更新时间:2023-11-29 17:15:58 25 4
gpt4 key购买 nike

我正在使用 OpenSuse。

当我尝试在系统上启动 mysql 时,它会在安装 MySQL 后运行。

rcmysql start

然后我收到此消息。

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

运行这两个命令后。

systemctl status mysql.service

● mysql.service - MySQL server Loaded: loaded (/usr/lib/systemd/system/mysql.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Tue 2018-07-31 22:57:28 CDT; 4min 2s ago Process: 21381 ExecStartPost=/usr/lib/mysql/mysql-systemd-helper wait (code=exited, status=1/FAILURE) Process: 21380 ExecStart=/usr/lib/mysql/mysql-systemd-helper start (code=exited, status=1/FAILURE) Process: 21369 ExecStartPre=/usr/lib/mysql/mysql-systemd-helper upgrade (code=exited, status=0/SUCCESS) Process: 21359 ExecStartPre=/usr/lib/mysql/mysql-systemd-helper install (code=exited, status=0/SUCCESS) Main PID: 21380 (code=exited, status=1/FAILURE)

然后我就跑

journalctl -xe

Jul 31 21:48:00 linux-kfrm org.kde.kwalletd5[2699]: kwalletd5 started Jul 31 21:48:00 linux-kfrm org.kde.kwalletd5[2699]: openAsync for ":1.4" Jul 31 21:48:00 linux-kfrm org.kde.kwalletd5[2699]: Setting useNewHash to true Jul 31 21:48:00 linux-kfrm org.kde.kwalletd5[2699]: Wallet new enough, using new hash Jul 31 21:48:00 linux-kfrm org.kde.kwalletd5[2699]: fsize: 957594615 encrypted.size(): 47528 blksz: 8 Jul 31 21:48:00 linux-kfrm org.kde.kwalletd5[2699]: Application ' "kded5" ' using kwallet without parent window! Jul 31 21:48:00 linux-kfrm org.kde.kwalletd5[2699]: Migration agent starting... Jul 31 21:48:00 linux-kfrm org.kde.kwalletd5[2699]: old wallets were already migrated Jul 31 21:48:00 linux-kfrm org.kde.kwalletd5[2699]: Migration agent stop. Jul 31 21:48:07 linux-kfrm org.kde.kwalletd5[2699]: Setting useNewHash to true Jul 31 21:48:07 linux-kfrm org.kde.kwalletd5[2699]: Wallet new enough, using new hash Jul 31 22:01:41 linux-kfrm su[5573]: (to root) sdrafahl on pts/2 Jul 31 22:01:41 linux-kfrm su[5573]: pam_unix(su:session): session opened for user root by (uid=1000) Jul 31 22:01:41 linux-kfrm su[5573]: pam_systemd(su:session): Cannot create session: Already running in a session Jul 31 22:01:41 linux-kfrm su[5573]: pam_unix(su:session): session closed for user root Jul 31 22:01:41 linux-kfrm su[5578]: (to root) sdrafahl on pts/2 Jul 31 22:01:41 linux-kfrm su[5578]: pam_unix(su:session): session opened for user root by (uid=1000) Jul 31 22:01:41 linux-kfrm su[5578]: pam_systemd(su:session): Cannot create session: Already running in a session Jul 31 22:15:28 linux-kfrm su[5578]: pam_unix(su:session): session closed for user root Jul 31 22:16:26 linux-kfrm su[16763]: (to root) sdrafahl on pts/0 Jul 31 22:16:26 linux-kfrm su[16763]: pam_unix(su:session): session opened for user root by sdrafahl(uid=1000) Jul 31 22:16:26 linux-kfrm su[16763]: pam_systemd(su:session): Cannot create session: Already running in a session Jul 31 22:18:05 linux-kfrm su[16949]: (to root) sdrafahl on pts/2 Jul 31 22:18:05 linux-kfrm su[16949]: pam_unix(su:session): session opened for user root by (uid=1000) Jul 31 22:18:05 linux-kfrm su[16949]: pam_systemd(su:session): Cannot create session: Already running in a session Jul 31 22:18:05 linux-kfrm su[16949]: pam_unix(su:session): session closed for user root Jul 31 22:18:05 linux-kfrm su[16954]: (to root) sdrafahl on pts/2 Jul 31 22:18:05 linux-kfrm su[16954]: pam_unix(su:session): session opened for user root by (uid=1000) Jul 31 22:18:05 linux-kfrm su[16954]: pam_systemd(su:session): Cannot create session: Already running in a session Jul 31 22:35:27 linux-kfrm su[2970]: (to root) sdrafahl on pts/4 Jul 31 22:35:27 linux-kfrm su[2970]: pam_unix(su:session): session opened for user root by (uid=1000) Jul 31 22:35:27 linux-kfrm su[2970]: pam_systemd(su:session): Cannot create session: Already running in a session Jul 31 22:35:27 linux-kfrm su[2970]: pam_unix(su:session): session closed for user root Jul 31 22:35:27 linux-kfrm su[2977]: (to root) sdrafahl on pts/4 Jul 31 22:35:27 linux-kfrm su[2977]: pam_unix(su:session): session opened for user root by (uid=1000) Jul 31 22:35:27 linux-kfrm su[2977]: pam_systemd(su:session): Cannot create session: Already running in a session

我尝试过卸载mysql并重新安装,但没有效果。

当我尝试执行mysql -u root -p时并输入密码,我收到此消息。

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2 "No such file or directory")

如何解决此问题并安装 mysql 以便可以登录?

最佳答案

错误日志中显示的部分

Cannot create session: Already running in a session Jul 31 22:35:27

通常意味着某些东西已经连接到mysql需要使用的端口上。当先前的启动尝试失败但仍然连接到 mysql 需要使用的端口时,通常会发生这种情况。另一个不太可能的原因是另一个程序已经在使用该端口。

如果您使用默认值安装了 mysql,那么它会尝试使用端口 3306,这是 mysql 的正常端口。因此,其他程序不太可能正在使用该端口。它很可能仍然与之前失败的 mysql 启动保持连接。

类型

netstat -an | grep -i 3306

这将告诉您是否有进程使用 mysql 端口。您可能会看到类似以下内容:

# netstat -an | grep 3306
tcp 0 0 xxx.xxx.xxx.xxx:3306 0.0.0.0:* LISTEN

这意味着你已经有一些东西在 mysql 端口上运行。因此,输入:

lsof -i :3306

你应该看到类似的内容:

COMMAND   PID  USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
mysqld NNNNN mysql 14u IPv4 1400263 0t0 TCP hostname:mysql (LISTEN)

这将告诉您哪个程序正在使用该端口。获取进程的PID并用

杀死进程
kill -9 NNNNN

然后尝试再次重启mysql

关于MySQL 无法启动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51625185/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com