我昨天把/usr/local/mysql/var/mysql/下的
user.MYD user.frm user.MYI 等三个文件替换了 因为忘记了密码 在网上看一个贴说这样可以解决问题
但后来发现没用mysql没法启动了现在我把user.MYD user.frm user.MYI 等三个文件换回原来的了 但是 mysql还是没法启动了
service mysqld start 失败 [root@web ~]# mysql -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server during query
[root@web ~]# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[root@web ~]#
user.MYD user.frm user.MYI 等三个文件替换了 因为忘记了密码 在网上看一个贴说这样可以解决问题
但后来发现没用mysql没法启动了现在我把user.MYD user.frm user.MYI 等三个文件换回原来的了 但是 mysql还是没法启动了
service mysqld start 失败 [root@web ~]# mysql -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server during query
[root@web ~]# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[root@web ~]#
你确定user.MYD user.frm user.MYI 这三个文件你放回来的时候你没变过么?应该换回来就可以了 当然你这样还是不知道密码 你可以通过这个方法修改你的root密码
1、killall -TERM MySQLd 停止MySQL服务2、bin/safe_MySQLd --skip-grant-tables &这样启动,不需要MySQL数据库密码就可以进入MySQL了3、执行MySQL进入MySQL4、use MySQLupdate user set passwordpassword=password('NEW PASSWORD') where user='root'; flush privileges; 5、killall -TERM MySQLd6、bin/safe_MySQLd 重启MySQL
现在密码的问题到其次了 关键Mysql都不能用了
三个文件我是恢复了啊 开始改的时候 我就把三个文件另存备份了的 文件修改日期都是08年的 现在还看得到哦
-rw-r--r-- 1 root root 11K 2008-04-23 user.frm
-rw-r--r-- 1 root root 324 2008-09-04 user.MYD
-rwxr-x--- 1 mysql mysql 2.0K 2008-09-04 user.MYI
bin/safe_MySQLd --skip-grant-tables &这样启动,不需要MySQL数据库密码就可以进入MySQL了执行MySQL进入MySQL
一些 ll -lh 出来的内容中
-rw-r--r-- 1 root root 11K 2008-04-23 user.frm
-rw-r--r-- 1 root root 324 2008-09-04 user.MYD
-rwxr-x--- 1 mysql mysql 2.0K 2008-09-04 user.MYI可能要把 root 变成 mysql 才行 怎么变 谁知道
chown mysql.mysql user.frm
chown mysql.mysql user.MYD
-rw-r--r-- 部分要改成
-rwxr-x---怎么改?
http://topic.csdn.net/u/20090515/21/2b3c9a12-d8a5-4bb1-9895-6069cef5aef8.html
/usr/local/mysql/bin
[root@web bin]# mysqladmin -u root flush-privileges password "newpassword"
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
[root@web bin]#
chmod 750 user.MYD
thax
看你那个贴 第一个方法第一步 就不行
[root@web init.d]# /etc/init.d/mysqld stop
MySQL manager or server PID file could not be found! [失败]
哥们有没有简单的重装方法啊
现在用这个Linux不是我装的 好像是rh4.2
好像没有yum刚才
[root@web init.d]# ps
PID TTY TIME CMD
2449 pts/0 00:00:00 bash
28749 pts/0 00:00:05 mysqld_safe
14056 pts/0 00:00:00 ps这个 mysqld_safe 现在有点用没有?