Articles in this section

Migration fails: MySQL server has gone away

Plesk for Linux kb: technical ext: migrator ABT: Group A mysql

Applicable to:

  • Plesk for Linux

Symptoms

  • Migration fails with the following error

    MySQL server has gone away

  • There was an upgrade from MariaDB 5.5 to MariaDB 10.x on the target server

  • Restarting MySQL/MariaDB server on the target server switches MySQL/MariaDB server to safe mode

    # service mysql restart
    ERROR! MySQL server PID file could not be found!
    Starting MySQL SUCCESS!
    [root@server]# 171103 21:31:13 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
    171103 21:31:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

  • The following errors are logged to /var/log/mariadb/mariadb.log 

    171103 21:34:04 [ERROR] mysqld: Can't lock aria control file '/var/lib/mysql/aria_log_control' for exclusive use, error: 11. Will retry for 30 seconds
    171103 21:34:35 [ERROR] mysqld: Got error 'Could not get an exclusive lock; file is probably in use by another process' when trying to use aria control file '/var/lib/mysql/aria_log_control'
    171103 21:34:35 [ERROR] Plugin 'Aria' init function returned error.
    171103 21:34:35 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.

Cause

Misconfiguration of the MySQL/MariaDB server.

Resolution

Restart MySQL/MariaDB correctly.

  1. Connect to the server via SSH

  2. Stop MySQL/MariaDB

    # service mariadb stop || service mysql stop || service mysqld stop

  3. Check if there are leftover MySQL/MariaDB processes

    # ps auxffww | grep -E "mysql|mariadb"

    root 2979 0.0 0.0 11768 1584 ? S 22:07 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file= /var/lib/mysql/hostname.pid
    mysql 3083 4.1 1.2 899628 298196 ? Sl 22:07 1:52 \_ /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mariadb/mariadb.log --pid-file= /var/lib/mysql/hostname.com.pid --socket= /var/lib/mysql/mysql.sock

  4. Kill these processes

    # kill -9 2979 3083

  5. Remove MySQL/MariaDB pid and sock files

    # rm -f /var/lib/mysql/hostname.pid /var/lib/mysql/hostname.pid /var/lib/mysql/mysql.sock

  6. Start MySQL/MariaDB server

    # service mariadb start || service mysql start || service mysqld start

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.