PhpStormでMySQLに接続するとColumn count of mysql.proc is wrong.エラー。

PhpStormでMySQLに接続するとエラーが表示された。

java.sql.SQLException: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50513, now running 50527. Please use mysql_upgrade to fix this error.
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122)
  at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)
  at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)
  at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2818)
  at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2157)
  at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2324)
  at com.mysql.jdbc.DatabaseMetaData$8.forEach(DatabaseMetaData.java:4544)
  at com.mysql.jdbc.DatabaseMetaData$8.forEach(DatabaseMetaData.java:4468)
  at com.mysql.jdbc.IterateBlock.doForAll(IterateBlock.java:51)
  at com.mysql.jdbc.DatabaseMetaData.getProceduresAndOrFunctions(DatabaseMetaData.java:4467)
  at com.mysql.jdbc.JDBC4DatabaseMetaData.getProcedures(JDBC4DatabaseMetaData.java:120)
  at com.intellij.persistence.jdbc.impl.RemoteDatabaseMetaDataImpl.getProcedures(RemoteDatabaseMetaDataImpl.java:556)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
  at sun.rmi.transport.Transport$1.run(Transport.java:177)
  at sun.rmi.transport.Transport$1.run(Transport.java:174)
  at java.security.AccessController.doPrivileged(Native Method)
  at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
  at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:724)
  at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
  at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
  at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
  at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
  at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
  at com.sun.proxy.$Proxy99.getProcedures(Unknown Source)
  at sun.reflect.GeneratedMethodAccessor372.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at com.intellij.execution.rmi.RemoteUtil$RemoteInvocationHandler.invoke(RemoteUtil.java:214)
  at com.sun.proxy.$Proxy100.getProcedures(Unknown Source)
  at com.intellij.javaee.dataSource.DatabaseSchemaLoader.loadProcedures(DatabaseSchemaLoader.java:737)
  at com.intellij.javaee.dataSource.DatabaseSchemaLoader.loadDataSourceState(DatabaseSchemaLoader.java:111)
  at com.intellij.javaee.dataSource.AbstractDataSource.refreshMetaData(AbstractDataSource.java:56)
  at com.intellij.javaee.dataSource.AbstractDataSource$1.perform(AbstractDataSource.java:34)
  at com.intellij.javaee.dataSource.AbstractDataSource$1.perform(AbstractDataSource.java:32)
  at com.intellij.javaee.dataSource.DataSource.performJdbcOperation(DataSource.java:373)
  at com.intellij.javaee.dataSource.AbstractDataSource.refreshMetaData(AbstractDataSource.java:32)
  at com.intellij.javaee.module.view.dataSource.DataSourceUiUtil$2.run(DataSourceUiUtil.java:176)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:464)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
  at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:373)
  at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:436)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:724)
  at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:153)

MySQL5.5.13と5.5.27でmysql.procのカラムの数が異なるらしい。 たしかにMySQLをアップデートしてから「mysql_upgrade 」はやってない。 mysql_upgrade を実行してみた。

# mysql_upgrade -u root -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck with default connection arguments
Running 'mysqlcheck with default connection arguments

・
・
・
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
・
・
・

Running 'mysql_fix_privilege_tables'...
OK

もう一度、PhpStormからDB接続。今度は成功した。

mydb@localhost: * synchronized PhpStormよくできている。普通だったら、はまるところだ。