简体   繁体   English

VPS无法通过套接字连接到本地MySQL服务器

[英]VPS Can't connect to local MySQL server through socket

the mysql in my VPS hosting has connection problem. 我的VPS托管中的mysql有连接问题。 I think it was due to my server drive has fail and my hosting has replace and rebuild a new drive. 我认为这是由于我的服务器驱动器发生故障并且我的主机已更换并重建了新的驱动器。 So I thought that my MySQL installation may have been corrupted, so I upgrade the mysql but the problem persist. 因此,我认为我的MySQL安装可能已损坏,因此我升级了mysql,但问题仍然存在。 How to fix this ? 如何解决呢? Thank you 谢谢

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> 

Here is the error log generated in /var/lib/mysql/domain.err 这是在/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.

Computer info 电脑资讯

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

Your MySQL server process either isn't running or the InnoDB assertion right after MySQL started listening for connections has hung the process. MySQL开始侦听连接后,您的MySQL服务器进程未运行或InnoDB断言使进程挂起。 Note these lines: 请注意以下几行:

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.

Go to the InnoDB Recovery page listed in that output and follow the instructions for forcing an InnoDB recovery. 转到该输出中列出的InnoDB Recovery页面,并按照指示进行InnoDB恢复。 It looks like you have a corrupt InnoDB database. 看来您的InnoDB数据库已损坏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM