蓝色枫 发表于 2022-5-9 14:40:01

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

Stoping LNMP...
Stoping nginx...done
ERROR! MySQL server PID file could not be found!
Gracefully shutting down php-fpm . done
Starting LNMP...
Starting nginx...done
Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/var/elogrewf.com.pid).
Starting php-fpmdone
/usr/local/mysql/var/elogrewf.com.err的内容:


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


#password        = your_password
port                = 3306
socket                = /tmp/mysql.sock


port                = 3306
socket                = /tmp/mysql.sock
datadir = /usr/local/mysql/var
default_storage_engine = MyISAM
loose-skip-innodb
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 1024
sort_buffer_size = 4M
net_buffer_length = 8K
read_buffer_size = 4M
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 64M
thread_cache_size = 128
query_cache_size = 128M
tmp_table_size = 128M

#skip-networking
max_connections = 500
max_connect_errors = 100
open_files_limit = 65535

log-bin=mysql-bin
binlog_format=mixed
server-id        = 1
expire_logs_days = 10

#innodb_file_per_table = 1
#innodb_data_home_dir = /usr/local/mysql/var
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql/var
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50


quick
max_allowed_packet = 16M


no-auto-rehash


key_buffer_size = 256M
sort_buffer_size = 4M
read_buffer = 2M
write_buffer = 2M


interactive-timeout求教军哥大佬,查了大半天百度谷歌都没解决才来打扰军哥大佬的,谢谢


licess 发表于 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 要设置的密码

正常情况下应该就能恢复了

蓝色枫 发表于 2022-5-9 21:37:54

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

非常感谢军哥大佬,可能是服务器不正常关机啥的导致的,已经卸载lnmp重装,保存留着下次用,这个服务器遇到两三次了。。。再次感谢

海豚V靓仔 发表于 2022-5-10 22:26:55

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

找了百度、狗哥半天没解决才来问,想着他辛苦回答了,却不想他重装解决了,哈哈!
页: [1]
查看完整版本: 请教军哥大佬,服务器宕机一次后重启就无法启动mysql