MySQL报错:The server quit without updating PID file 我的解决思路和方法

这篇具有很好参考价值的文章主要介绍了MySQL报错:The server quit without updating PID file 我的解决思路和方法。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

今天在学习mysql 二进制日志的时候需要在编辑my.cnf的文件,产生的一系列报错,个人的排错思路和方法,仅供参考。

the server quit without updating pid file,mysql,mysql,数据库,服务器

重启damon、重启mysql 发现报错

Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/data/mysqld.pid).
the server quit without updating pid file,mysql,mysql,数据库,服务器

发现注释这三行配置之后发现可以正常启动,那么问题就出现在这三行代码上

log-bin = mysql-bin  
#binlog_expire_logs_seconds = 600
#max_binlog_size = 200M

the server quit without updating pid file,mysql,mysql,数据库,服务器 查询日志发现报错:You have enabled the binary log, but you haven't provided the mandatory server-id. Please refer to the proper server start-up parameters documentation#您已经启用了二进制日志,但是没有提供必需的服务器id。请参考适当的服务器启动参数文档

 经过百度发现:MySQL 5.7.3以后版本必须配置server-id,否则无法启用MySQL二进制日志
 尝试启动 在my.cnf中添加 server-id = 1   唯一的服务辨识号,数值位于 1 到 2^32-1之间。此值在master和slave上都需要设置。
如果 “master-host” 没有被设置,则默认为1, 但是如果忽略此选项,MySQL不会作为master生效

添加参数,并尝试启动。 

发现又报错:Can't connect to local MySQL server through socket '/tmp/mysql.sock'

the server quit without updating pid file,mysql,mysql,数据库,服务器

mysql的连接方式有两种:一种是TCP/IP、一种是socket连接

mysql.sock的作用是程序与mysqlserver处于同一台机器,发起本地连接时可用。 
连接localhost通常通过一个Unix域套接字文件进行,一般是/tmp/mysql.sock。
如果套接字文件被删除了,本地客户就不能连接。/tmp 文件夹属于临时文件,随时可能被删除。
每次mysql 启动的时候,都会生成一个mysql.sock 的文件,

socket = /var/lib/mysql/mysql.sock   建议将sock文件移动至下var/lib/mysql/  

尝试重新启动 发现还是报错 Starting MySQL. ERROR! The server quit without updating PID file

排错:

 1. 检查目录权限    

 2. selinux是否关闭  

 3. 检查my.cnf参数 port,datadir,basedir,socket 是否配置正常

排错发现是我配置sock目录时候,并没有给予权限

chown -R mysql:mysql /var/lib/mysql/   #设置权限,并查看
ls -alh | grep mysql
drwxr-xr-x.  2 mysql   mysql      6 Sep 14 16:19 mysql

再次尝试启动mysql 发现还是报错:Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/data/mysqld.pid).

1. tail -f /usr/local/mysql/data/mysql.err  /查询MySQL自带的日志文件mysql.err

 #发现没有关键错误信息

the server quit without updating pid file,mysql,mysql,数据库,服务器

 2. tail /var/log/messages  #记录了绝大多数的系统日志 

 2022-09-15T06:32:03.776090Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2022-09-15T06:32:03.776188Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.33-log) starting as process 57901 ...
2022-09-15T06:32:03.780168Z 0 [Note] InnoDB: PUNCH HOLE support available
2022-09-15T06:32:03.780229Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-09-15T06:32:03.780253Z 0 [Note] InnoDB: Uses event mutexes
2022-09-15T06:32:03.780278Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2022-09-15T06:32:03.780411Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-09-15T06:32:03.780419Z 0 [Note] InnoDB: Using Linux native AIO
2022-09-15T06:32:03.780605Z 0 [Note] InnoDB: Number of pools: 1
2022-09-15T06:32:03.780695Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-09-15T06:32:03.781783Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2022-09-15T06:32:03.787253Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-09-15T06:32:03.789167Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-09-15T06:32:03.800452Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2022-09-15T06:32:03.805695Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-09-15T06:32:03.805865Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-09-15T06:32:03.819123Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-09-15T06:32:03.820045Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2022-09-15T06:32:03.820088Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2022-09-15T06:32:03.821153Z 0 [Note] InnoDB: Waiting for purge to start
2022-09-15T06:32:03.872143Z 0 [Note] InnoDB: 5.7.33 started; log sequence number 2980979
2022-09-15T06:32:03.872679Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/mysql/data/ib_buffer_pool
2022-09-15T06:32:03.872896Z 0 [Note] Plugin 'FEDERATED' is disabled.
2022-09-15T06:32:03.873741Z 0 [Note] InnoDB: Buffer pool(s) load completed at 220915 14:32:03
2022-09-15T06:32:03.875555Z 0 [ERROR] unknown variable 'binlog_expire_logs_seconds=600'
2022-09-15T06:32:03.875596Z 0 [ERROR] Aborting

2022-09-15T06:32:03.875610Z 0 [Note] Binlog end
2022-09-15T06:32:03.875666Z 0 [Note] Shutting down plugin 'ngram'
2022-09-15T06:32:03.875678Z 0 [Note] Shutting down plugin 'partition'
2022-09-15T06:32:03.875681Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2022-09-15T06:32:03.875684Z 0 [Note] Shutting down plugin 'ARCHIVE'
2022-09-15T06:32:03.875687Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2022-09-15T06:32:03.875727Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2022-09-15T06:32:03.875730Z 0 [Note] Shutting down plugin 'MyISAM'
2022-09-15T06:32:03.875738Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2022-09-15T06:32:03.875741Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2022-09-15T06:32:03.875742Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2022-09-15T06:32:03.875744Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2022-09-15T06:32:03.875745Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2022-09-15T06:32:03.875746Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2022-09-15T06:32:03.875748Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2022-09-15T06:32:03.875749Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2022-09-15T06:32:03.875751Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2022-09-15T06:32:03.875752Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2022-09-15T06:32:03.875754Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2022-09-15T06:32:03.875755Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2022-09-15T06:32:03.875757Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2022-09-15T06:32:03.875758Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2022-09-15T06:32:03.875760Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2022-09-15T06:32:03.875761Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2022-09-15T06:32:03.875763Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2022-09-15T06:32:03.875764Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2022-09-15T06:32:03.875766Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2022-09-15T06:32:03.875767Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2022-09-15T06:32:03.875769Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2022-09-15T06:32:03.875770Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2022-09-15T06:32:03.875772Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2022-09-15T06:32:03.875773Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2022-09-15T06:32:03.875775Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2022-09-15T06:32:03.875777Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2022-09-15T06:32:03.875778Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2022-09-15T06:32:03.875780Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2022-09-15T06:32:03.875781Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2022-09-15T06:32:03.875782Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2022-09-15T06:32:03.875784Z 0 [Note] Shutting down plugin 'InnoDB'
2022-09-15T06:32:03.875854Z 0 [Note] InnoDB: FTS optimize thread exiting.
2022-09-15T06:32:03.876196Z 0 [Note] InnoDB: Starting shutdown...
2022-09-15T06:32:03.976840Z 0 [Note] InnoDB: Dumping buffer pool(s) to /usr/local/mysql/data/ib_buffer_pool
2022-09-15T06:32:03.977146Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 220915 14:32:03
2022-09-15T06:32:05.488923Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2980998
2022-09-15T06:32:05.490187Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2022-09-15T06:32:05.490231Z 0 [Note] Shutting down plugin 'MEMORY'
2022-09-15T06:32:05.490243Z 0 [Note] Shutting down plugin 'CSV'
2022-09-15T06:32:05.490246Z 0 [Note] Shutting down plugin 'sha256_password'
2022-09-15T06:32:05.490248Z 0 [Note] Shutting down plugin 'mysql_native_password'
2022-09-15T06:32:05.490337Z 0 [Note] Shutting down plugin 'binlog'
2022-09-15T06:32:05.490478Z 0 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

 发现关键字 unknown variable 未知的变量  binlog_expire_logs_seconds

 我照着视频里面的单词一个个敲,不是我敲错。尝试寻找度娘

在mysql 8.0版本中新增了binlog_expire_logs_seconds,该参数表示binlog的失效日期单位秒。
8.0之前的版本,binlog的失效日志用expire_logs_days来配置,单位是天。

参考链接:mysql 8 新特性之binlog_expire_logs_seconds - 墨天轮​​​​​​

因为我是学习了8.0和5.7版本的Mysql都有在学习,win端使用的是8.0 linux安装的是5.7

所以是我mysql版本的问题导致。更改参数 

[mysqld]
user = mysql
port = 3306
basedir = /usr/local/mysql  
# 创建目录
datadir = /usr/local/mysql/data   
# 数据库目录
pid-file = /usr/local/mysql/data/mysqld.pid 
# mysql进程
log-error = /usr/local/mysql/data/mysql.err   
# 错误日志
socket = /var/lib/mysql/mysql.sock
# 可以socket文件方式登录mysql
log-bin = /usr/local/mysql/data/bin-log/mysql-bin.log
server-id = 1
#binlog_expire_logs_seconds = 600
max_binlog_size = 200M
#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]

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
explicit_defaults_for_timestamp=true

再再再再次尝试启动MySQL 

[root@master lib]# ps -aux | grep mysql
root      53523  0.0  0.0 108096   620 pts/1    S+   14:00   0:00 tail -f /usr/local/mysql/data/mysql.err
root      54867  0.0  0.0  11820  1612 pts/0    S    14:05   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/mysqld.pid
mysql     55106  1.1  2.2 1145048 176116 pts/0  Sl   14:05   0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/mysql.err --pid-file=/usr/local/mysql/data/mysqld.pid --socket=/var/lib/mysql/mysql.sock --port=3306
root      55162  0.0  0.0 112816   976 pts/0    S+   14:05   0:00 grep --color=auto mysql
[root@master lib]# netstat -anptu | grep :3306
tcp6       0      0 :::3306                 :::*                    LISTEN      55106/mysqld   

尝试登录MySQL 发现又报错:错误2002 (HY000):无法通过套接字'/tmp/ MySQL连接到本地MySQL服务器

[root@master lib]# mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock #设置软连接

the server quit without updating pid file,mysql,mysql,数据库,服务器

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| atguigudb          |
| #mysql50#bin-log   |
| mysql              |
| performance_schema |
| sys                |
| test               |
| test_u             |
+--------------------+
8 rows in set (0.00 sec)

 登录成功!!! 继续继续MySQL!!!冲文章来源地址https://www.toymoban.com/news/detail-815756.html

到了这里,关于MySQL报错:The server quit without updating PID file 我的解决思路和方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • mysql启动时报错:Starting MySQL... ERROR! The server quit without updating PID file快速解决

    1、可能是/opt/mysql/data/数据目录mysql用户没有权限(修改数据目录的权限) 解决方法 :给予权限,执行 “chown -R mysql.mysql /opt/mysql/data” 然后重新启动mysqld 2、可能进程里已经存在mysql进程 解决方法:用命令“ps -ef|grep mysqld”查看是否有mysqld进程,如果有使用“kill -9 进程号”

    2024年02月08日
    浏览(47)
  • 【填坑向】MySQL常见报错及处理系列(ERROR! The server quit without updating PID file)

    本系列其他文章 【填坑向】MySQL常见报错及处理系列(Communications link failure Access denied for user ‘root‘@‘localhost‘)_AQin1012的博客-CSDN博客 翻一下大致的意思就是默认会按照如下的顺序读取配置文件,我上面贴出的配置文件就是第一个/etc/my.cnf,但显然目前在运行的MySQL并不是

    2024年02月11日
    浏览(40)
  • mac m2停止mysql报错:ERROR! MySQL server PID file could not be found!

    出现这个问题的原因有很多,我只说下我是怎么解决的。 首先看一下,你的mysql服务,有没有指定配置文件。 执行完之后,会输出几个可能的目录,你可以到各个目录下看看有没有my.cnf文件。如果没有,那就需要新建一个。 进入/etc目录,可能需要root权限,使用如下命令切换

    2024年02月09日
    浏览(58)
  • 【BUG解决】sudo apt-get update 报错 E: The repository ‘http://xxx Release‘ does not have a Release file.

    前两天在虚拟机Vmware中安装了Ubuntu18.04操作系统,因为需要安装其他工具。所以想着执行命令 更新一下系统,以便进行安装。结果出现 “E: The repository ‘http://xxx Release‘ does not have a Release file.” 以及 “E: Problem executing scripts APT::Update::Post-Invoke-Success \\\'if /usr/bin/test -w /var/cache

    2023年04月10日
    浏览(36)
  • ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option 解决办法

    情景 当我导入大数据量时,使用 LOAD DATA INFILE 进行导入,出现了错误 ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement 表明你的 MySQL 服务器启用了 --secure-file-priv 选项,这个选项限制了 MySQL 可以执行文件操作的目录。这通常出现在尝

    2024年04月28日
    浏览(42)
  • ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot exec

    MySQL在进行导出全表数据的时候提示ERROR 1290 出现这个问题的原因是mysql的secure_file_prive这个选项没有开启,或者这个选择了特定的文件路径,只有在这个文件路径下的文件才能导入导出mysql 首先在mysql环境下查询secure_file_priv参数。 参数secure_file_priv的值及含义如下: secure_fil

    2024年02月10日
    浏览(53)
  • 讲解nginx.pid“ failed (2: The system cannot find the file specified

    目录 讲解 \\\"nginx.pid\\\" failed (2: The system cannot find the file specified 1. Nginx配置文件错误 2. Nginx配置文件权限问题 3. Nginx启动失败 解决问题 示例代码:处理 \\\"nginx.pid\\\" failed (2: The system cannot find the file specified 在使用Nginx时,你可能会遇到以下错误消息之一: 这个错误消息通常出现在启

    2024年01月19日
    浏览(51)
  • Hadoop安装MySQL报错The GPG keys listed for the “MySQL 5.7 Community Server“ repository are already......

    目录 一、报错描述: 二、问题分析: 三、问题解决: 四、命令运行: 五、总结            没有配置正确的密钥URL,可能是由于密钥过期导致。在安装MySQL服务之前,先导入正确的密钥URL。记住是在安装之前导入!!!          下面命令2022表示年份。先导入正确的密

    2024年02月12日
    浏览(50)
  • 解决MySQL报错:“The last packet sent successfully to the server was 0 milliseconds ago.”

    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 问题原因: 之所以出现异常,是由于数据库回收了连接,而系统的缓冲池不知道,继续使用被回收的连

    2024年02月08日
    浏览(52)
  • [已解决]ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables 成功解决报错

    在mysql中创建新用户、给数据库授权用户及配置服务器IP时发生的这个报错:ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement。 报错说mysql服务器正在运行不能添加,但是关闭mysql服务器重新登录时会有这个报错:ERROR 2002 (HY000): Can‘

    2024年04月15日
    浏览(48)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包