说来惭愧,MySQL我已经在只将用于,非常赞赏阶段。
甚至一些比较深层次的管理,不熟悉如何,我们要加强啊!
最近。系统测试,使用MySQL数据库,你需要在表上创建触发器。该数据库是安装在机。但。在任何情况下,你不能创建触发器,如以下背景错误消息:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: TRIGGER command denied to user 'root'@'mortimer-PC' for table 't_user' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2677) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2627) at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:841) at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:681) at com.apusic.jdbc.adapter.StatementHandle.execute(Unknown Source) at com.apusic.esb.base.util.SQLUtil.createDBObjectIfNecessary(SQLUtil.java:263) at com.apusic.esb.base.util.SQLUtil.createDBObjectIfNecessary(SQLUtil.java:225) at com.apusic.esb.config.trigger.mysql.MySqlTriggerManager.createTriggersIfNecessary(MySqlTriggerManager.java:83) at com.apusic.esb.config.trigger.TriggerConfigManager.deploy(TriggerConfigManager.java:331) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.apusic.esb.base.communication.CommInvokeUtil.invoke(CommInvokeUtil.java:139) at com.apusic.esb.base.communication.CommInvokeUtil.invoke(CommInvokeUtil.java:43) at com.apusic.esb.base.communication.CommInvokeUtil.invoke(CommInvokeUtil.java:27) at com.apusic.esb.base.communication.socket.server.CommSocketServer$RequestProcessor.run(CommSocketServer.java:99) at com.apusic.util.ThreadPoolImpl$WorkerThread.run(Unknown Source) 2014-06-25 10:38:42 错误 [apusic.com.apusic.esb.config.trigger.TriggerConfigManager] com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: TRIGGER command denied to user 'root'@'mortimer-PC' for table 't_user' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2677) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2627) at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:841) at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:681) at com.apusic.jdbc.adapter.StatementHandle.execute(Unknown Source) at com.apusic.esb.base.util.SQLUtil.createDBObjectIfNecessary(SQLUtil.java:263) at com.apusic.esb.base.util.SQLUtil.createDBObjectIfNecessary(SQLUtil.java:225) at com.apusic.esb.config.trigger.mysql.MySqlTriggerManager.createTriggersIfNecessary(MySqlTriggerManager.java:83) at com.apusic.esb.config.trigger.TriggerConfigManager.deploy(TriggerConfigManager.java:331) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.apusic.esb.base.communication.CommInvokeUtil.invoke(CommInvokeUtil.java:139) at com.apusic.esb.base.communication.CommInvokeUtil.invoke(CommInvokeUtil.java:43) at com.apusic.esb.base.communication.CommInvokeUtil.invoke(CommInvokeUtil.java:27) at com.apusic.esb.base.communication.socket.server.CommSocketServer$RequestProcessor.run(CommSocketServer.java:99) at com.apusic.util.ThreadPoolImpl$WorkerThread.run(Unknown Source)分析错误信息:TRIGGER command denied to user 'root'@'mortimer-PC' for table 't_user',看起来是不同意root用户在t_user表上运行TRIGGER命令。为啥不同意?
分析下,首先怀疑是否驱动的问题。由于,驱动确实存在不匹配的问题,驱动的版本号较低(针对5.0),而服务器版本号为5.5。替换驱动之后问题依然。
其次,分析错误信息本身。不同意运行神马命令。看起来貌似是权限问题。Navicat连接数据库。查看用户权限,发现用户“root@%”的“Trigger”一栏未选中!而此次连接的用户,看起来是“root@mortimer-PC”,因此。“root@localhost”的规则,貌似不会生效,预计是此原因,造成无法创建触发器。
调整“root@%”用户的权限,选中“Trigger”柱,重启MySQL服务,另一个连接MySQL,创建触发器,OK。
版权声明:本文博客原创文章,博客,未经同意,不得转载。