VPS侦探论坛

 找回密码
 注册
查看: 1822|回复: 3

请教军哥大佬,服务器宕机一次后重启就无法启动mysql

[复制链接]
发表于 2022-5-9 14:40:01 | 显示全部楼层 |阅读模式

  1. Stoping LNMP...
  2. Stoping nginx...  done
  3. ERROR! MySQL server PID file could not be found!
  4. Gracefully shutting down php-fpm . done
  5. Starting LNMP...
  6. Starting nginx...  done
  7. Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/var/elogrewf.com.pid).
  8. Starting php-fpm  done
复制代码
/usr/local/mysql/var/elogrewf.com.err的内容:


  1. 220509 14:35:43 [Note] Plugin 'FEDERATED' is disabled.
  2. 220509 14:35:43 [Note] Plugin 'InnoDB' is disabled.
  3. /usr/local/mysql/bin/mysqld: Can't find file: 'plugin' (errno: 2)
  4. 220509 14:35:43 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
  5. 220509 14:35:43 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
  6. 220509 14:35:43 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
  7. 220509 14:35:43 [Note] Server socket created on IP: '0.0.0.0'.
  8. 220509 14:35:43 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: 'host' (errno: 2)
复制代码
my.cnf配置,都是默认安装的配置,印象中是没改过

  1. [client]
  2. #password        = your_password
  3. port                = 3306
  4. socket                = /tmp/mysql.sock

  5. [mysqld]
  6. port                = 3306
  7. socket                = /tmp/mysql.sock
  8. datadir = /usr/local/mysql/var
  9. default_storage_engine = MyISAM
  10. loose-skip-innodb
  11. skip-external-locking
  12. key_buffer_size = 256M
  13. max_allowed_packet = 1M
  14. table_open_cache = 1024
  15. sort_buffer_size = 4M
  16. net_buffer_length = 8K
  17. read_buffer_size = 4M
  18. read_rnd_buffer_size = 512K
  19. myisam_sort_buffer_size = 64M
  20. thread_cache_size = 128
  21. query_cache_size = 128M
  22. tmp_table_size = 128M

  23. #skip-networking
  24. max_connections = 500
  25. max_connect_errors = 100
  26. open_files_limit = 65535

  27. log-bin=mysql-bin
  28. binlog_format=mixed
  29. server-id        = 1
  30. expire_logs_days = 10

  31. #innodb_file_per_table = 1
  32. #innodb_data_home_dir = /usr/local/mysql/var
  33. #innodb_data_file_path = ibdata1:10M:autoextend
  34. #innodb_log_group_home_dir = /usr/local/mysql/var
  35. #innodb_buffer_pool_size = 16M
  36. #innodb_additional_mem_pool_size = 2M
  37. #innodb_log_file_size = 5M
  38. #innodb_log_buffer_size = 8M
  39. #innodb_flush_log_at_trx_commit = 1
  40. #innodb_lock_wait_timeout = 50

  41. [mysqldump]
  42. quick
  43. max_allowed_packet = 16M

  44. [mysql]
  45. no-auto-rehash

  46. [myisamchk]
  47. key_buffer_size = 256M
  48. sort_buffer_size = 4M
  49. read_buffer = 2M
  50. write_buffer = 2M

  51. [mysqlhotcopy]
  52. interactive-timeout
复制代码
求教军哥大佬,查了大半天百度谷歌都没解决才来打扰军哥大佬的,谢谢


美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2022-5-9 19:55:06 | 显示全部楼层


大概率是你误删了mysql数据库目录下的文件
先!!!备份 /usr/local/mysql/var 目录!!!,再进行下面操作试试
你没有说明mysql具体版本
MySQL 5.5/5.6
/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql
MySQL 5.7及更高版本:
/usr/local/mysql/bin/mysqld --initialize-insecure --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql

/etc/init.d/mysql start
/usr/local/mysql/bin/mysqladmin -u root password 要设置的密码

正常情况下应该就能恢复了
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2022-5-9 21:37:54 | 显示全部楼层

licess 发表于 2022-5-9 19:55
大概率是你误删了mysql数据库目录下的文件
先!!!备份 /usr/local/mysql/var 目录!!!,再进行下面操作 ...

非常感谢军哥大佬,可能是服务器不正常关机啥的导致的,已经卸载lnmp重装,保存留着下次用,这个服务器遇到两三次了。。。再次感谢
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2022-5-10 22:26:55 | 显示全部楼层



licess 发表于 2022-5-9 19:55
大概率是你误删了mysql数据库目录下的文件
先!!!备份 /usr/local/mysql/var 目录!!!,再进行下面操作 ...

找了百度、狗哥半天没解决才来问,想着他辛苦回答了,却不想他重装解决了,哈哈!
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-11-6 00:35 , Processed in 0.026711 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表