gpt4 book ai didi

mysql - 启动 MySQL 守护进程时遇到问题

转载 作者:行者123 更新时间:2023-11-29 14:21:21 30 4
gpt4 key购买 nike

我是这里论坛的新手,但我希望变得更加活跃,因为我最近购买了一台专用服务器,并且我在它上面运行 Fedora,所以这是一个持续的学习过程,我在 BASH 方面的水平相当平均,但我知道的足够多,我是一名软件开发人员,不仅仅是网络技术人员。这导致了我最初的问题,我在重新启动我的 dedi 后启动 MySQL 守护进程时遇到问题,我不知道为什么它突然这样做,我从服务器运行 PHPMyAdmin 并通过 CLI 发出某些命令MySQL,但重新启动后,每次尝试启动守护程序实例时都会收到此错误:

[root@ks23085 ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@ks23085 ~]# systemctl mysqld start
Unknown operation mysqld
[root@ks23085 ~]# systemctl start mysqld
Failed to issue method call: Unit name mysqld is not valid.
[root@ks23085 ~]# systemctl start mysqld.service
[root@ks23085 ~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/path/to/mysql.sock' (2)

这很奇怪,因为在我重新启动之前它工作得很好,我没有更新它或更改安装,我做的唯一的事情就是安装 postfix,但我不明白为什么这会导致任何问题使用 MySQL :S

我真的需要帮助解决这个问题,我已经尝试了谷歌的几种解决方案,但没有任何结果。提前谢谢大家。

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

更新1:

好吧,我找到了mysqld所在的目录,它是'/usr/libexec/mysqld',我在这个目录中输入了'./mysqld start',它指定了这个输出:

120729  1:49:09 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729 1:49:09 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729 1:49:09 [Warning] Can't create test file /run/mysql/ks23085.lower-test
120729 1:49:09 [Warning] Can't create test file /run/mysql/ks23085.lower-test
./mysqld: Can't change dir to '/run/mysql/' (Errcode: 2)
120729 1:49:09 [ERROR] Aborting

120729 1:49:09 [Note] ./mysqld: Shutdown complete

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~更新2:

我通过在“run/”中使用所有旧数据库创建“mysql”目录,设法解决了目录问题,但现在我似乎遇到了一个似乎不太容易修复的错误:/

这是输出:

120729  2:15:59 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729 2:15:59 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729 2:15:59 [Warning] Can't create test file /run/mysql/ks23085.lower-test
120729 2:15:59 [Warning] Can't create test file /run/mysql/ks23085.lower-test
120729 2:15:59 [Note] Plugin 'FEDERATED' is disabled.
120729 2:15:59 [Note] Plugin 'InnoDB' is disabled.
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
120729 2:15:59 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120729 2:15:59 [ERROR] mysqld: unknown option '--skip-locking'
120729 2:15:59 [ERROR] Aborting

120729 2:15:59 [Note] mysqld: Shutdown complete

最佳答案

official doc指出此错误有 2 个可能的原因:

  1. You don't have permissions to access the directory /var/lib/mysql/whatever.sock because mysql is the owner of the folder or
  2. /path/whatever.sock doesn't exist.

执行以下命令来查找您的套接字:

mysqladmin variables | grep socket

按照建议添加到配置文件:

You can try this though [Linux specific, but what other operating systems are there?] Go to /etc/my.cnf and change/add the lines:

[mysqld]

datadir=/var/lib/mysql

socket=/tmp/mysql.sock

[client]

socket=/tmp/mysql.sock

2)不要忘记检查您的权限!

关于mysql - 启动 MySQL 守护进程时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11702464/

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