Aparición del error «Cannot load from mysql.proc» durante la actualización/traspaso de Plesk

Síntomas

  1. La actualización de MySQL no puede completarse debido al siguiente error:
    Error message or request description : ERROR while trying to upgrade APSC SQL database from 11.1.0
    Check the error reason(see log file: /tmp/plesk_11.5.30_installation.log), fix and try again
    

    En /tmp/plesk_11.5.30_installation.log puede verse lo siguiente:

    ERROR 1548 (HY000) at line 67: Cannot load from mysql.proc. The table is probably corrupted
    
  2. Cuando se intenta eliminar un procedimiento, incluso en el caso de que este no exista, se obtiene lo siguiente:
    mysql> DROP PROCEDURE IF EXISTS test1234;
    ERROR 1548 (HY000): Cannot load from mysql.proc. The table is probably corrupted
    

Causa

La tabla Proc está dañada o bien la estructura de una columna de la tabla no es correcta.

Resolución

  1. Compruebe que la base de datos MySQL no está corrupta. Puede realizar esta comprobación ejecutando el comando «mysqlcheck»:
    # mysqlcheck -uadmin -p`cat /etc/psa/.psa.shadow ` mysql
    mysql.columns_priv                                 OK
    mysql.db                                           OK
    mysql.event                                        OK
    mysql.func                                         OK
    mysql.general_log                                  OK
    mysql.help_category                                OK
    mysql.help_keyword                                 OK
    mysql.help_relation                                OK
    mysql.help_topic                                   OK
    mysql.host                                         OK
    mysql.ndb_binlog_index                             OK
    mysql.plugin                                       OK
    mysql.proc                                         OK
    mysql.procs_priv                                   OK
    mysql.proxies_priv                                 OK
    mysql.servers                                      OK
    mysql.slow_log                                     OK
    mysql.tables_priv                                  OK
    mysql.time_zone                                    OK
    mysql.time_zone_leap_second                        OK
    mysql.time_zone_name                               OK
    mysql.time_zone_transition                         OK
    mysql.time_zone_transition_type                    OK
    mysql.user 
                                    OK
    
  2. De ser necesario, repare la tabla:
    # mysql -uadmin -p`cat /etc/psa/.psa.shadow` mysql -Ne"REPAIR TABLE mysql.proc"
    
    +------------+--------+----------+----------+
    | Table      | Op     | Msg_type | Msg_text |
    +------------+--------+----------+----------+
    | mysql.proc | repair | status   | OK       |
    +------------+--------+----------+----------+
    1 row in set (0.00 sec
    
  3. Compruebe si en el registro de MySQL existe algún error:
    # grep log /etc/my.cnf
    log-error=/var/log/mysqld.log
    # grep ERROR /var/log/mysqld.log
    [ERROR] Incorrect definition of table mysql.proc: expected column 'comment' at position 15 to have type text, found type char(64).
    

    Este error denota que la estructura de la columna comment en la tabla proc no es correcta o bien que no ha podido ser actualizada. Intente cambiar el tipo de la siguiente forma:

    # mysql -uadmin -p`cat /etc/psa/.psa.shadow` mysql -Ne"alter table proc change comment comment text"
    Query OK, 0 rows affected (0.01 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    
  4. Si actualizó el servidor MySQL, compruebe que se ejecuta el script mysql_upgrade.