当我们将 5.0.45 升级到 5.1.42 时出现以下错误。我需要使用 mysql_upgrade 或 mysqlcheck 吗?
引起:java.sql.SQLException:mysql.proc 的列数错误。预期20,发现16。用MySQL 50045创建,现在运行50142。请使用mysql_upgrade修复此错误。
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1761)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2046)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1964)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1949)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:792)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:1)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:586)
Run Code Online (Sandbox Code Playgroud)
如果您在 ubuntu 上运行 XAMPP 设置,请导航到:
/opt/lampp/bin
Run Code Online (Sandbox Code Playgroud)
然后运行
./mysql_upgrade
Run Code Online (Sandbox Code Playgroud)
它应该检查您所有现有的数据库,最后它可能会给您以下错误消息:
无法在 MariaDB 服务器数据目录中创建升级信息文件“/opt/lampp/var/mysql/mysql_upgrade_info”,错误号:13
不用担心,您现在可以毫无错误地导入 db.sql 脚本。
如果您想从同一位置访问 MariaDB shell:
如果您还没有设置密码:
./mysql -u root
Run Code Online (Sandbox Code Playgroud)
如果您已设置密码:
./mysql -u root -p
Run Code Online (Sandbox Code Playgroud)