java 执行mysql 8.0.11存储过程报错

执行存储过程,报错

 

java.sql.SQLException: The user specified as a definer ('root'@'10.%.%.%') does not exist

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:127)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)

at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)

at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:960)

at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:388)

at com.mysql.cj.jdbc.CallableStatement.execute(CallableStatement.java:809)

at com.paxunke.smart.utils.MysqlUtils.execWriteReportProc(MysqlUtils.java:260)

at com.paxunke.smart.testcase.Test.main(Test.java:125)

 

 

解决办法:

执行sql语句:

  GRANT ALL PRIVILEGES ON database_name.* to 'root'@'localhost';

  FLUSH   PRIVILEGES; 

 

存储过程中 definer修改为:root@localhost

  

 

 

猜你喜欢

转载自www.cnblogs.com/testway/p/9018893.html