首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从其他服务器复制文件后,MySQL无法启动

从其他服务器复制文件后,MySQL无法启动
EN

Ask Ubuntu用户
提问于 2017-01-25 21:19:07
回答 1查看 1.9K关注 0票数 2

最近,由于服务器故障(与MySQL无关),我不得不重新安装Ubuntu 16。我现在已经重新安装了Ubuntu 16,对于MySQL,我已经将备份文件从我的旧服务器上传到新的安装中,但是它无法启动。当我跑的时候

代码语言:javascript
复制
service mysql status

我得到了

代码语言:javascript
复制
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (start-post) since Wed 2017-01-25 15:08:54 CST; 3s ago
  Process: 7872 ExecStart=/usr/bin/mysqld_safe (code=exited, status=0/SUCCESS)
  Process: 7869 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 7872 (code=exited, status=0/SUCCESS);         : 7873 (mysql-systemd-s)
   CGroup: /system.slice/mysql.service
           └─control
             ├─7873 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─8209 sleep 1

Jan 25 15:08:54 s101287 systemd[1]: Starting MySQL Community Server...
Jan 25 15:08:54 s101287 mysqld_safe[7872]: 170125 15:08:54 mysqld_safe Logging to '/var/lib/mysql/s101287.err'.
Jan 25 15:08:54 s101287 mysqld_safe[7872]: 170125 15:08:54 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

在试图启动服务器之后。下面是/var/lib/mysql目录的ls -la:

代码语言:javascript
复制
total 176224
drwxr-xr-x 13 mysql mysql     4096 Jan 25 15:08 .
drwxr-xr-x 48 root  root      4096 Jan 25 13:14 ..
drwxr-xr-x  2 mysql mysql    24576 Jan 25 13:59 apache
-rwxr-xr-x  1 mysql mysql       56 Jan 25 13:05 auto.cnf
drwxr-xr-x  2 mysql mysql     4096 Jan  6 04:49 banlist
drwxr-xr-x  2 mysql mysql     4096 Jan  6 04:50 daemon
-rwxr-xr-x  1 mysql mysql        0 Jan 25 13:14 debian-5.6.flag
drwxr-xr-x  2 mysql mysql     4096 Jan 25 14:12 dnttmp
-rwxr-xr-x  1 mysql mysql 79691776 Jan 25 14:54 ibdata1
-rwxr-xr-x  1 mysql mysql 50331648 Jan 25 15:08 ib_logfile0
-rwxr-xr-x  1 mysql mysql 50331648 Jan 25 14:54 ib_logfile1
drwxr-xr-x  2 mysql mysql     4096 Jan  6 04:50 multicraft_daemon
drwxr-xr-x  2 mysql mysql     4096 Jan  6 04:50 multicraft_panel
drwxr-xr-x  2 mysql mysql     4096 Jan 25 13:05 mysql
drwxr-xr-x  2 mysql mysql     4096 Jan  6 04:51 panel
drwxr-xr-x  2 mysql mysql     4096 Jan 25 13:14 performance_schema
drwxr-xr-x  2 mysql mysql     4096 Jan  6 04:51 phpmyadmin
-rw-r-----  1 mysql mysql    15651 Jan 25 15:08 s101287.err
drwxr-xr-x  2 mysql mysql     4096 Jan 16 07:02 unturned1

我查看了上面目录中的错误文件,发现导致问题的文件是‘ibdata1 1’、'ib_logfile0‘和'ib_logfile1’。如果我用安装一个全新版本的MySQL的原始副本来替换它们,它就能正常工作。唯一的问题是,当我尝试从数据库加载不同的表时,它会给出“表不存在”。在做了更多的调查之后,我发现了这个职位,这使我相信导致问题的文件是必要的。下面是使用旧服务器的文件启动服务器时的错误日志:

代码语言:javascript
复制
170125 14:59:25 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2017-01-25 14:59:25 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2017-01-25 14:59:25 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-01-25 14:59:25 0 [Note] /usr/sbin/mysqld (mysqld 5.6.28-0ubuntu0.15.04.1) starting as process 7489 ...
2017-01-25 14:59:25 7489 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2017-01-25 14:59:25 7489 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)

2017-01-25 14:59:25 7489 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
2017-01-25 14:59:25 7489 [Note] Plugin 'FEDERATED' is disabled.
2017-01-25 14:59:25 7489 [ERROR] Function 'innodb' already exists
2017-01-25 14:59:25 7489 [Warning] Couldn't load plugin named 'innodb' with soname 'ha_innodb.so'.
2017-01-25 14:59:25 7489 [ERROR] Function 'federated' already exists
2017-01-25 14:59:25 7489 [Warning] Couldn't load plugin named 'federated' with soname 'ha_federated.so'.
2017-01-25 14:59:25 7489 [ERROR] Function 'blackhole' already exists
2017-01-25 14:59:25 7489 [Warning] Couldn't load plugin named 'blackhole' with soname 'ha_blackhole.so'.
2017-01-25 14:59:25 7489 [ERROR] Function 'archive' already exists
2017-01-25 14:59:25 7489 [Warning] Couldn't load plugin named 'archive' with soname 'ha_archive.so'.
2017-01-25 14:59:25 7489 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-01-25 14:59:25 7489 [Note] InnoDB: The InnoDB memory heap is disabled
2017-01-25 14:59:25 7489 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-01-25 14:59:25 7489 [Note] InnoDB: Memory barrier is not used
2017-01-25 14:59:25 7489 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-01-25 14:59:25 7489 [Note] InnoDB: Using Linux native AIO
2017-01-25 14:59:25 7489 [Note] InnoDB: Using CPU crc32 instructions
2017-01-25 14:59:25 7489 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-01-25 14:59:25 7489 [Note] InnoDB: Completed initialization of buffer pool
2017-01-25 14:59:25 7489 [Note] InnoDB: Highest supported file format is Barracuda.
2017-01-25 14:59:25 7489 [Note] InnoDB: 128 rollback segment(s) are active.
2017-01-25 14:59:25 7489 [Note] InnoDB: Waiting for purge to start
InnoDB: Error: tablespace id is 219 in the data dictionary
InnoDB: but in file ./mysql/innodb_index_stats.ibd it is 2!
2017-01-25 14:59:25 7f4817fff700  InnoDB: Assertion failure in thread 139947617023744 in file fil0fil.cc line 796
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.6/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
20:59:25 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=16777216
read_buffer_size=131072
max_used_connections=0
max_threads=151
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 = 76296 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+0x3b)[0x8e7c3b]
/usr/sbin/mysqld(handle_fatal_signal+0x36a)[0x646c0a]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10d10)[0x7f4834132d10]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37)[0x7f4833560267]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7f4833561eca]
/usr/sbin/mysqld[0xa5f211]
/usr/sbin/mysqld[0xa5f3ce]
/usr/sbin/mysqld[0xa6932b]
/usr/sbin/mysqld[0xa31041]
/usr/sbin/mysqld[0xa190ac]
/usr/sbin/mysqld[0x9feed5]
/usr/sbin/mysqld[0x9a5b80]
/usr/sbin/mysqld[0x9a2807]
/usr/sbin/mysqld[0x9a42a7]
/usr/sbin/mysqld[0x972845]
/usr/sbin/mysqld[0x9c9405]
/usr/sbin/mysqld[0x9bc6c5]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76aa)[0x7f48341296aa]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f4833631eed]
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.
170125 14:59:25 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

这两行窥见了我的兴趣:

代码语言:javascript
复制
InnoDB: Error: tablespace id is 219 in the data dictionary
InnoDB: but in file ./mysql/innodb_index_stats.ibd it is 2!

如果问题在于表空间和另一个文件的in不匹配,是导致这个问题还是我的理论进入了深度?如果我无法更改其中一个文件中的ids,我如何成功地使用那些导致问题的文件,正如我已经说过的,我需要它们才能使我的一半的表工作。

EN

回答 1

Ask Ubuntu用户

发布于 2017-01-26 04:20:54

在使我的MySQL服务器无法工作后,我意识到我没有将/var/lib/mysql全部复制到新服务器上。在停止MySQL服务器、删除安装/var/lib/mysql之后,我复制了我的旧文件并成功地启动了服务器。将文件混合在两个副本之间是行不通的!感谢所有想帮忙的人!

票数 2
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/876233

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档