Description:
MySQL 5.6.7 crashes with SIGSEGV when upgrading from 5.1 directly. This is not an officially supported operation, but SIGSEGV is too bad. Stacktrace is like below:
/home/mikiya/opt/mysql/5.6.7/bin/mysqld(my_print_stacktrace+0x2e)[0x8a60fe]
/home/mikiya/opt/mysql/5.6.7/bin/mysqld(handle_fatal_signal+0x377)[0x64d647]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7f83a8811cb0]
/home/mikiya/opt/mysql/5.6.7/bin/mysqld(_Z9get_fieldP11st_mem_rootP5Field+0x49)[0x746979]
/home/mikiya/opt/mysql/5.6.7/bin/mysqld(_Z10acl_reloadP3THD+0x116d)[0x66313d]
/home/mikiya/opt/mysql/5.6.7/bin/mysqld(_Z8acl_initb+0x14d)[0x663bbd]
/home/mikiya/opt/mysql/5.6.7/bin/mysqld(_Z11mysqld_mainiPPc+0x1692)[0x597ba2]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f83a7c5276d]
/home/mikiya/opt/mysql/5.6.7/bin/mysqld[0x58cd7d]
The server crashes when reading the acl table. To workaround this problem, specify --skip-grant-tables option, then execute mysql_upgrade.
How to repeat:
Upgrade from MySQL 5.1 to 5.6 with physical data files.
Suggested fix:
In the following code from sql_acl.cc...
if (table->s->fields >= 36)
{
/* Starting from 5.0.3 we have max_user_connections field */
ptr= get_field(thd->mem_root,
table->field[MYSQL_USER_FIELD_MAX_USER_CONNECTIONS]);
user.user_resource.user_conn= ptr ? atoi(ptr) : 0;
}
There is no field at MYSQL_USER_FIELD_MAX_USER_CONNECTIONS'th position, because Create_tablespace_priv was added in 5.5. Please do not specify MYSQL_USER_FIELD_MAX_USER_CONNECTIONS directly there, and make it conditional.