错误:mysqld.service:启动请求重复太快,在manjaro上

vnzz0bqm  于 2023-03-22  发布在  Mysql
关注(0)|答案(5)|浏览(824)

昨天我更新了我的manjaro。从那以后我遇到了很多问题。
首先,我打字

systemctl status mysqld.service

启动MySQL,但它会出现以下错误

mysqld.service: Start request repeated too quickly.

我发现了很多建议,但它们都不起作用。
我已经试过了:

  • 使用以下命令检查MySQL数据目录的权限,所有权应为mysql:mysql,目录权限应为700。
ls -ld /var/lib/mysql/
  • 使用以下命令检查MySQL数据目录中数据库的权限。该目录中所有文件的所有权应为mysql:mysql
ls -lh /var/lib/mysql/
  • 使用以下命令检查侦听网络TCP端口
netstat -ntlp
  • 使用以下命令检查MySQL日志文件中是否存在任何错误:
cat /var/log/mysql/mysqld.log
  • 尝试使用以下命令启动MySQL
mysqld_safe --defaults-file=/etc/my.cf

我的错误:

dong@dong-manjaro  /home/dong   systemctl status mysqld.service                                                                          13:30:33 
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2019-08-22 13:30:29 CST; 6s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 8006 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
  Process: 8027 ExecStart=/usr/bin/mysqld $MYSQLD_OPTS (code=exited, status=127)
 Main PID: 8027 (code=exited, status=127)

8月 22 13:30:29 dong-manjaro systemd[1]: mysqld.service: Service RestartSec=100ms expired, scheduling restart.
8月 22 13:30:29 dong-manjaro systemd[1]: mysqld.service: Scheduled restart job, restart counter is at 5.
8月 22 13:30:29 dong-manjaro systemd[1]: Stopped MySQL Server.
8月 22 13:30:29 dong-manjaro systemd[1]: **mysqld.service: Start request repeated too quickly.**
8月 22 13:30:29 dong-manjaro systemd[1]: **mysqld.service: Failed with result 'exit-code'.**
8月 22 13:30:29 dong-manjaro systemd[1]: **Failed to start MySQL Server.**
brjng4g3

brjng4g31#

我也遇到过同样的问题,并这样解决了这个问题:
如果/var/log/mysql文件夹不存在:

sudo mkdir /var/log/mysql

然后给予此文件夹权限:

sudo chown -R mysql:mysql /var/log/mysql

sudo systemctl stop mysql

sudo systemctl start mysql
fdbelqdn

fdbelqdn2#

遇到类似问题。请按照以下步骤操作(Sql server版本:'8.0.22- 0ubuntu0.20.04.3')

1. Edit file: mysqld.cnf under directory: /etc/mysql/mysql.conf.d
 2. Ensure that below basic settings are made in file mysqld.cnf and save it.
 # * Basic Settings
 user       = mysql
 pid-file   = /var/run/mysqld/mysqld.pid
 socket     =   /var/run/mysqld/mysqld.sock
 port       = 3306
 datadir    = /var/lib/mysql
 # setting for localhost
 bind-address       = 127.0.0.1
 mysqlx-bind-address    = 127.0.0.1
 log_error = /var/log/mysql/error.log
 server-id      = 1
 log_bin            = /var/log/mysql/mysql-bin.log
 max_binlog_size    = 100M
 3. Check error log files under directory: /var/log/mysql 
 4. Remove all log files: Cd /var/log/mysql $ sudo rm -R error*
 5. Start mysql server: $ sudo systemctl start mysql.service
 6. Check status of mysql server: $ sudo systemctl status mysql.service
kq4fsx7k

kq4fsx7k3#

对我们来说,它是chown日志文件:

[root@tree ~]# ls -alh /var/log/mysqld.log 
-rw-r----- 1 root logs 8.3K Apr 20 02:17 /var/log/mysqld.log
[root@tree ~]# chown mysql: /var/log/mysqld.log 
[root@tree ~]# systemctl start mysqld
[root@tree ~]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-04-20 15:32:01 UTC; 20s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 28339 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 28313 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 28342 (mysqld)
   Memory: 43.3G
   CGroup: /system.slice/mysqld.service
           └─28342 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

摆脱了同样的失败。

polhcujo

polhcujo4#

我是这样固定的:

sudo chown -R mysql:mysql /var/lib/mysql

sudo systemctl start mysql
rggaifut

rggaifut5#

我在Ubuntu 22.04上遇到了同样的问题。
您需要通过执行以下命令使mysql用户成为datadirlog_error目录的所有者:

sudo chown -R mysql /var/lib/mysql /var/log/mysql

目录的路径可能不同。您可以在配置文件中找到相应的路径,该文件位于:/etc/mysql/mysql.conf.d/mysqld.cnf

相关问题