The user specified as a definer (' @ ') does solution of not exist

Source: Internet
Author: User
From the company using NAVICAT to export the SQL script database, go back and pour, when running the project, the console reported errors as follows:
caused by:java.sql.SQLException:The user specified as a definer (' @ ') does not exist
At Com.mysql.jdbc.SQLError.createSQLException (sqlerror.java:1075)
At Com.mysql.jdbc.MysqlIO.checkErrorPacket (mysqlio.java:3566)
At Com.mysql.jdbc.MysqlIO.checkErrorPacket (mysqlio.java:3498)
At Com.mysql.jdbc.MysqlIO.sendCommand (mysqlio.java:1959)
At Com.mysql.jdbc.MysqlIO.sqlQueryDirect (mysqlio.java:2113)
At Com.mysql.jdbc.ConnectionImpl.execSQL (connectionimpl.java:2568)
At Com.mysql.jdbc.PreparedStatement.executeInternal (preparedstatement.java:2113)
At Com.mysql.jdbc.PreparedStatement.executeQuery (preparedstatement.java:2275)
At Com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery (newproxypreparedstatement.java:76)
At Org.hibernate.jdbc.AbstractBatcher.getResultSet (abstractbatcher.java:186)
At Org.hibernate.loader.Loader.getResultSet (loader.java:1787)
At Org.hibernate.loader.Loader.doQuery (loader.java:674)
At Org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections (loader.java:236)
At Org.hibernate.loader.Loader.doList (loader.java:2220)
... More


The above error is the wrong time to upload a new project to the server. Error means that database access does not have the ' @ ' user. This is mainly in the new view and stored procedures, straightforward in the MySQL Visual graphics tool copy code to the server to run, MySQL will automatically generate some code, such as copy out of the view statement:
-- ----------------------------
--View structure for ' Sys_teacher_role_view '
-- ----------------------------
DROP VIEW IF EXISTS ' Sys_teacher_role_view ';
CREATE algorithm=undefined definer= ' @ ' SQL security definer VIEW ' Sys_teacher_role_view 'As select ' Tea_teacher '. ' Teaid ' as ' teaid ', ' sys_user_role '. ' Employee_nember ' as ' employee_nember ', ' tea_teacher '. ' Staffnumbers ' as ' staffnumbers ', ' tea_teacher '. ' TeacherName ' as ' teachername ', ' sys_user_role '. ' role_id ' as ' role_id ', ' Tea_teacher '. ' Identity_card ' as ' Identity_card ' from (' Tea_teacher ' left join ' sys_user_role ' on (' Sys_user_role '. ') Employee_nember ' = ' tea_teacher '. ' Teaid '));

should read:
-- ----------------------------
--View structure for ' Sys_teacher_role_view '
-- ----------------------------
DROP VIEW IF EXISTS ' Sys_teacher_role_view ';
CREATE VIEW ' Sys_teacher_role_view 'As select ' Tea_teacher '. ' Teaid ' as ' teaid ', ' sys_user_role '. ' Employee_nember ' as ' employee_nember ', ' tea_teacher '. ' Staffnumbers ' as ' staffnumbers ', ' tea_teacher '. ' TeacherName ' as ' teachername ', ' sys_user_role '. ' role_id ' as ' role_id ', ' Tea_teacher '. ' Identity_card ' as ' Identity_card ' from (' Tea_teacher ' left join ' sys_user_role ' on (' Sys_user_role '. ') Employee_nember ' = ' tea_teacher '. ' Teaid '));

Stored procedures are the same, and often ignore this problem and cause the above error.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.