我已经将 mysql 版本从 5.1 升级到 5.6。
我已遵循的步骤:
- 我已卸载旧版本并安装了新版本。
- 重置 mysql root 密码
恢复特定数据库的数据库转储
现在我需要创建新用户并授予服务器中的所有权限。但在创建用户时我收到错误。
mysql> 创建用户'newuser'@'localhost',由'密码'标识;
ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) ERROR: Can't connect to the server
我在 PhpMyadmin 中也遇到了同样的错误。
我目前已按照其他人的建议修改了这些设置
innodb_force_recovery = 1
wait_timeout = 28800
connect_timeout = 28800
错误日志:
12:54:24 UTC - mysqld got signal 11 ;
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=1048576
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 61073 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x7f8182657500
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 = 7f8152cb5e40 thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x2c)[0x7f81817481cc]
/usr/sbin/mysqld(handle_fatal_signal+0x3d2)[0x7f81814a8572]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f81801bd340]
/usr/sbin/mysqld(+0x47f0b4)[0x7f81814d10b4]
/usr/sbin/mysqld(_Z17mysql_create_userP3THDR4ListI11st_lex_userE+0x371)[0x7f81814d6e91]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x211d)[0x7f8181531b8d]
/usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x3c8)[0x7f8181536308]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x2363)[0x7f8181538d03]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0x1f5)[0x7f81814fe715]
/usr/sbin/mysqld(handle_one_connection+0x40)[0x7f81814fe770]
/usr/sbin/mysqld(pfs_spawn_thread+0x140)[0x7f818178a370]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x8182)[0x7f81801b5182]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f817f8d847d]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f8138005030): is an invalid pointer
Connection ID (thread ID): 5
Status: NOT_KILLED
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.
2015-07-03 18:24:25 30722 [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.
2015-07-03 18:24:25 30722 [Note] Plugin 'FEDERATED' is disabled.
2015-07-03 18:24:25 30722 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-07-03 18:24:25 30722 [Note] InnoDB: The InnoDB memory heap is disabled
2015-07-03 18:24:25 30722 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-07-03 18:24:25 30722 [Note] InnoDB: Compressed tables use zlib 1.2.8
2015-07-03 18:24:25 30722 [Note] InnoDB: Using Linux native AIO
2015-07-03 18:24:25 30722 [Note] InnoDB: Using CPU crc32 instructions
2015-07-03 18:24:25 30722 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-07-03 18:24:25 30722 [Note] InnoDB: Completed initialization of buffer pool
2015-07-03 18:24:25 30722 [Note] InnoDB: Highest supported file format is Barracuda.
2015-07-03 18:24:25 30722 [Note] InnoDB: The log sequence numbers 38271843239 and 38271843239 in ibdata files do not match the log sequence number 38271843249 in the ib_logfiles!
2015-07-03 18:24:25 30722 [Note] InnoDB: Database was not shutdown normally!
2015-07-03 18:24:25 30722 [Note] InnoDB: Starting crash recovery.
2015-07-03 18:24:25 30722 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-07-03 18:24:25 30722 [Note] InnoDB: Restoring possible half-written data pages
2015-07-03 18:24:25 30722 [Note] InnoDB: from the doublewrite buffer...
2015-07-03 18:24:25 30722 [Note] InnoDB: 128 rollback segment(s) are active.
2015-07-03 18:24:25 30722 [Note] InnoDB: Waiting for purge to start
2015-07-03 18:24:25 30722 [Note] InnoDB: 5.6.19 started; log sequence number 38271843249
2015-07-03 18:24:25 30722 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2015-07-03 18:24:25 30722 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2015-07-03 18:24:25 30722 [Note] Server socket created on IP: '127.0.0.1'.
2015-07-03 18:24:25 30722 [Note] Event Scheduler: Loaded 0 events
2015-07-03 18:24:25 30722 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.19-0ubuntu0.14.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu)
答案1
你似乎已经击中错误“任何形式的语句CREATE USER x IDENTIFIED BY 'x'
都会使mysqld崩溃”所述原因是mysql
从旧版 MySQL 恢复或重用的数据库中缺少“password_expired”列。所述解决方案是运行mysql_upgrade
。
答案2
您不应设置 innodb 强制恢复。首先,您必须确定 MySQL 崩溃的根本原因。您应该查看 MySQL 错误日志。通常它应该存在于 Mysql 数据目录中,但根据您的安装,它可能位于不同的位置。
另外,确保您的 my.cnf 中没有无效或不兼容的条目。