0

我的 VPS 主机中的 mysql 有连接问题。我认为这是由于我的服务器驱动器出现故障,并且我的主机已更换并重建了新驱动器。所以我认为我的MySQL安装可能已经损坏,所以我升级了mysql但问题仍然存在。如何解决这个问题?谢谢

root@user [~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.68-cll MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use testdb
No connection. Trying to reconnect...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
ERROR: 
Can't connect to the server

mysql> 

这是 /var/lib/mysql/domain.err 中生成的错误日志

Version: '5.1.68-cll'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
130303 17:28:49  InnoDB: Assertion failure in thread 2965224304 in file fsp/fsp0fsp.c line 3341
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
09:28:49 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.

key_buffer_size=8384512
read_buffer_size=131072
max_used_connections=0
max_threads=500
thread_count=0
connection_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1099543 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x25)[0x848d5e5]
/usr/sbin/mysqld(handle_fatal_signal+0x42a)[0x82dd84a]
[0xb775c500]
/lib/libc.so.6(abort+0x17a)[0xb75513da]
/usr/sbin/mysqld(fseg_free_step_not_header+0x1a1)[0x83afab1]
/usr/sbin/mysqld[0x8409078]
/usr/sbin/mysqld[0x84094d0]
/usr/sbin/mysqld(trx_purge_fetch_next_rec+0x7a)[0x840960a]
/usr/sbin/mysqld(row_purge_step+0x37)[0x83eefb7]
/usr/sbin/mysqld(que_run_threads+0x4f7)[0x83de467]
/usr/sbin/mysqld(trx_purge+0x32f)[0x840787f]
/usr/sbin/mysqld(srv_master_thread+0x417)[0x8400267]
/lib/libpthread.so.0(+0x6a49)[0xb773ca49]
/lib/libc.so.6(clone+0x5e)[0xb760763e]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
130303 17:28:49 mysqld_safe Number of processes running now: 0
130303 17:28:49 mysqld_safe mysqld restarted
130303 17:28:49 [Warning] '--log_slow_queries' is deprecated and will be removed in a future release. Please use ''--slow_query_log'/'--slow_query_log_file'' instead.
130303 17:28:49 [Warning] '--safe-show-database' is deprecated and will be removed in a future release. Please use 'GRANT SHOW DATABASES' instead.
130303 17:28:49 [Warning] '--log' is deprecated and will be removed in a future release. Please use ''--general_log'/'--general_log_file'' instead.
130303 17:28:49 [Note] Plugin 'FEDERATED' is disabled.
130303 17:28:49  InnoDB: Initializing buffer pool, size = 8.0M
130303 17:28:49  InnoDB: Completed initialization of buffer pool
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130303 17:28:49  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
130303 17:28:49  InnoDB: Started; log sequence number 0 1605434197
130303 17:28:49 [Warning] 'user' entry 'root@s1.replace.com' ignored in --skip-name-resolve mode.
130303 17:28:49 [Warning] 'user' entry 'root@xx1.no-ip.org' ignored in --skip-name-resolve mode.
130303 17:28:49 [Note] Event Scheduler: Loaded 0 events
130303 17:28:49 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.68-cll'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
130303 17:28:50  InnoDB: Assertion failure in thread 2965224304 in file fsp/fsp0fsp.c line 3341
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.

电脑信息

root@user [~]# uname -a
Linux domain.com 2.6.32-042stab072.10 #1 SMP Wed Jan 16 18:54:05 MSK 2013 i686 i686 i386 GNU/Linux

root@user [~]# free -m
             total       used       free     shared    buffers     cached
Mem:          2560       1323       1236          0          0        826
-/+ buffers/cache:        497       2062
Swap:            0          0          0

root@user [~]# cat /etc/my.cnf 
[mysqld]
max_connections=500
log-slow-queries
log-error
safe-show-database
bind-address=xx.x.xx.xxx
skip-name-resolve
connect_timeout= 10
log=1
log_warnings = 2
max_allowed_packet = 64M
4

1 回答 1

1

您的 MySQL 服务器进程没有运行,或者在 MySQL 开始侦听连接后 InnoDB 断言已挂起该进程。请注意以下几行:

130303 17:28:49 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.68-cll'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
130303 17:28:50  InnoDB: Assertion failure in thread 2965224304 in file fsp/fsp0fsp.c line 3341
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.

转到该输出中列出的InnoDB 恢复页面,然后按照强制 InnoDB 恢复的说明进行操作。看起来您的 InnoDB 数据库已损坏。

于 2013-03-03T13:48:46.903 回答