Mysql 服务器启动失败

Mysql 服务器启动失败

我已经在 Google 上搜索了两个小时,我需要你的帮助。我在 Debian 虚拟机上,我克隆了它。唯一的变化是它有新的 IP 地址。

Mysql 不再启动:

Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!

没有名为 mysql 的进程。/var/log 中的所有 mysql 日志文件都是空的。

这是我的.cnf 文件:

[client]
port        = 3306
socket      = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice        = 0

[mysqld]
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /var/lib/mysql
tmpdir      = /tmp
language    = /usr/share/mysql/english
skip-external-locking
bind-address        = 127.0.0.1
key_buffer      = 16M
max_allowed_packet  = 16M
thread_stack        = 192K
thread_cache_size       = 8
myisam-recover         = BACKUP
query_cache_limit   = 1M
query_cache_size        = 16M
general_log_file        = /var/log/mysql/mysql.log
log_bin         = /var/log/mysql/mysql-bin.log
expire_logs_days    = 10
max_binlog_size         = 100M

[mysqldump]
quick
quote-names
max_allowed_packet  = 16M
[mysql]
[isamchk]
key_buffer      = 16M
[mysqld_safe]
syslog

以下是 ifconfig 的结果:

eth0      Link encap:Ethernet  HWaddr 00:0c:29:12:98:9a  
          inet adr:192.168.1.138  Bcast:192.168.1.255  Masque:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:754 errors:0 dropped:0 overruns:0 frame:0
          TX packets:106 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000 
          RX bytes:101177 (98.8 KiB)  TX bytes:17719 (17.3 KiB)

lo        Link encap:Boucle locale  
          inet adr:127.0.0.1  Masque:255.0.0.0
          adr inet6: ::1/128 Scope:Hôte
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0 
          RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)

根据要求,以下是结果:sudo -u mysql mysqld,以下是结果:

root@debian:/home/nicolas/Bureau# sudo -u mysql mysqld
121004 14:26:57 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
121004 14:26:57 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
121004 14:26:57  InnoDB: Initializing buffer pool, size = 8.0M
121004 14:26:57  InnoDB: Completed initialization of buffer pool
121004 14:26:57  InnoDB: Started; log sequence number 0 70822697
121004 14:26:57 [Note] Recovering after a crash using /var/log/mysql/mysql-bin
121004 14:26:57 [Note] Starting crash recovery...
121004 14:26:57 [Note] Crash recovery finished.
121004 14:26:57 [ERROR] mysqld: Can't find file: './mysql/host.frm' (errno: 13)
121004 14:26:57 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)

答案1

可能是权限/var/lib/mysql错误,或者数据库结构未初始化。尝试手动运行mysql:

#sudo -u mysql mysqld

您将在控制台上获得所有守护进程的输出。

答案2

这是 13 的错误

$ perror 13 OS 错误代码 13:权限被拒绝

所以我希望你尝试以下方法

首先确保权限没问题

chown -R mysql: /var/lib/mysql

然后尝试启动 mysql。如果它不起作用,并且你不关心你的任何数据,请执行以下操作

rm -rf /var/lib/mysql/*
mysql_install_db
chown -R mysql: /var/lib/mysql

然后重新启动 mysql

答案3

由于我无法安装它,所以我重新安装了一个新的虚拟机,感谢您的帮助,这是个好主意

答案4

我有同样的问题。

/tmp 目录不可写,因此 MYSQL 无法写入一些所需的文件。

只要这样做:

chmod 777 /tmp

并重启mysql

/etc/init.d/mysql start

相关内容