你的位置:
问答吧
-> 数据库
-> 问题详情
MYSQL无法启动 并出现了极其严重的错误
我装的是FedoraCore7在图形化界面安装的MySQL的全部11个包(yum install)
现在无论如何都无法启动
求助于各位大侠!是跪求!
[root@localhost ~]# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@localhost ~]# /etc/rc.d/init.d/mysqld start
Timeout error occurred trying to start MySQL Daemon.
启动 MySQL: [失败]
于是查看日志:
mysqld.log
080724 14:23:39 mysqld started
080724 14:23:39 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
080724 14:23:39 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./localhost.localdomain.err
InnoDB: File operation call: 'stat'.
InnoDB: Error: os_file_readdir_next_file() returned -1 in
InnoDB: directory .
InnoDB: Crash recovery may have failed for some .ibd files!
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
080724 14:23:39 InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 0 36808.
InnoDB: Doing recovery: scanned up to log sequence number 0 43655
080724 14:23:39 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
080724 14:23:40 InnoDB: Started; log sequence number 0 43655
080724 14:23:40 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
080724 14:23:40 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
080724 14:23:40 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
080724 14:23:40 mysqld ended
080724 14:24:43 mysqld started
080724 14:24:43 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
080724 14:24:43 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./localhost.localdomain.err
InnoDB: File operation call: 'stat'.
InnoDB: Error: os_file_readdir_next_file() returned -1 in
InnoDB: directory .
InnoDB: Crash recovery may have failed for some .ibd files!
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
080724 14:24:43 InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 0 36808.
InnoDB: Doing recovery: scanned up to log sequence number 0 43655
080724 14:24:43 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
080724 14:24:44 InnoDB: Started; log sequence number 0 43655
080724 14:24:44 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
080724 14:24:44 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
080724 14:24:44 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
080724 14:24:44 mysqld ended
是权限问题吗? 我一切都是在root下操作的啊 数据库还没有别的用户
我也运行了 mysql_install_db --user=root 还是不能启动
find -name host.frm 也的确没找到
谢谢各位大侠!跪谢!
作者: 嘿呀
发布时间: 2008-07-24
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
应该是权限问题。
有没新建mysql用户和用户组?
作者: streetboy85
发布时间: 2008-07-24
大概是你的配置文件里mysql.sock的路径不对
看看/etc下,my.cnf文件,里面是不是有
/var/lib/mysql/mysql.sock
改成/tmp/mysql.sock试试,
这个问题俺遇到过,google 下,不难解决
:)
作者: rsmgnu
发布时间: 2008-07-24
注意看 /var 下面 mysql 相关的权限,以前我也遇到过一次,把权限重新设了就好了
作者: Aeonspr
发布时间: 2008-07-24
真是谢谢楼上几位,这个论坛算回复最有价值的!赞!
不过仍存在问题
设置了权限 也更改了my.cnf
[root@localhost mysql]# chown -R mysql:mysql /var/lib/mysql
[root@localhost mysql]# cd /
[root@localhost /]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@localhost /]# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/tmp/mysql.sock
# socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
SElinux也关了,google的方法都试过了,都没有用,所以感到很奇怪
谢谢大家,求助中~~~
(安装是图形化的添加软件安装的,不是安装下载的rpm包更不是编译源码安装的,没想到却还是有问题,所以感觉太菜了,linux恶补中~)
作者: 嘿呀
发布时间: 2008-07-25
你的mysqld已经启动了一个进程.所以你再启动就出现了Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
ps aux|grep mysql
看一下
作者: yoursmile
发布时间: 2008-07-25
# ps aux|grep mysql
root 2074 0.0 0.1 6052 1252 ? S 13:44 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/tmp/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid
mysql 2134 0.0 2.1 136096 16864 ? Sl 13:44 0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/tmp/mysql.sock
root 3269 0.0 0.0 5372 696 pts/0 R+ 13:51 0:00 grep mysql
[root@localhost ~]# /etc/rc.d/init.d/mysqld status
mysqld (pid 2134) 正在运行...
[root@localhost ~]# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
作者: 嘿呀
发布时间: 2008-07-27
装好了有没有初始化库,看看有没有mysql那个库
作者: cuci
发布时间: 2008-07-27
配置修改后重启mysql了吗?
作者: chenyx
发布时间: 2008-07-27
QUOTE:
原帖由 嘿呀 于 2008-7-27 13:55 发表
# ps aux|grep mysql
root 2074 0.0 0.1 6052 1252 ? S 13:44 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/tmp/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid
mysql 2134 0.0 2.1 136096 16864 ? Sl 13:44 0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/tmp/mysql.sock
root 3269 0.0 0.0 5372 696 pts/0 R+ 13:51 0:00 grep mysql
[root@localhost ~]# /etc/rc.d/init.d/mysqld status
mysqld (pid 2134) 正在运行...
[root@localhost ~]# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket ’/var/lib/mysql/mysql.sock' (2)
发现没有?mysql.sock路径不一样,说明你系统里可能装了2个mysql,配置不一样,你把mysql的完整路径也给出,再登陆
作者: yoursmile
发布时间: 2008-07-27