at MySql.Data.MySqlClient.MySqlStream.ReadPacket 或 FUNCTION account.AddMinutes does not exist

 

Application Exception
MySql.Data.MySqlClient.MySqlException
FUNCTION account.AddMinutes does not exist
Description: HTTP 500.Error processing request.

Details: Non-web exception. Exception origin (name of application or object): MySql.Data.

Exception stack trace:
  at MySql.Data.MySqlClient.MySqlStream.ReadPacket () [0x00096] in <861c41359f7d4496a8fdf269ae744290>:0 
  at MySql.Data.MySqlClient.NativeDriver.GetResult (System.Int32& affectedRow, System.Int64& insertedId) [0x00026] in <861c41359f7d4496a8fdf269ae744290>:0 
  at MySql.Data.MySqlClient.Driver.GetResult (System.Int32 statementId, System.Int32& affectedRows, System.Int64& insertedId) [0x00000] in <861c41359f7d4496a8fdf269ae744290>:0 
  at MySql.Data.MySqlClient.Driver.NextResult (System.Int32 statementId, System.Boolean force) [0x00023] in <861c41359f7d4496a8fdf269ae744290>:0 
  at MySql.Data.MySqlClient.MySqlDataReader.NextResult () [0x00205] in <861c41359f7d4496a8fdf269ae744290>:0 
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x00315] in <861c41359f7d4496a8fdf269ae744290>:0 
  at (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(System.Data.CommandBehavior)
  at MySql.Data.Entity.EFMySqlCommand.ExecuteDbDataReader (System.Data.CommandBehavior behavior) [0x00000] in <b27518aaf75f49a0a3ab22b953222fb2>:0 
  at System.Data.Common.DbCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x00000] in <cfa990f4664f406f913105998890457d>:0 
  at (wrapper remoting-invoke-with-check) System.Data.Common.DbCommand.ExecuteReader(System.Data.CommandBehavior)
  at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c (System.Data.Common.DbCommand t, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext`1[TResult] c) [0x00007] in <000f54522ad145bf987b3043022f9799>:0 
  at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1[TInterceptor].Dispatch[TTarget,TInterceptionContext,TResult] (TTarget target, System.Func`3[T1,T2,TResult] operation, TInterceptionContext interceptionContext, System.Action`3[T1,T2,T3] executing, System.Action`3[T1,T2,T3] executed) [0x0000f] in <000f54522ad145bf987b3043022f9799>:0 
  at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader (System.Data.Common.DbCommand command, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext interceptionContext) [0x00042] in <000f54522ad145bf987b3043022f9799>:0 
  at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader (System.Data.CommandBehavior behavior) [0x00046] in <000f54522ad145bf987b3043022f9799>:0 
  at System.Data.Common.DbCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x00000] in <cfa990f4664f406f913105998890457d>:0 
  at (wrapper remoting-invoke-with-check) System.Data.Common.DbCommand.ExecuteReader(System.Data.CommandBehavior)
  at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands (System.Data.Entity.Core.EntityClient.EntityCommand entityCommand, System.Data.CommandBehavior behavior) [0x0000a] in <000f54522ad145bf987b3043022f9799>:0 
Version Information: 5.8.1.0 (tarball); ASP.NET Version: 4.0.30319.42000

 

 

FUNCTION account.AddMinutes does not exist

 

[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c

在 /etc/my.cnf 文件里加上如下:
sql_mode='NO_ENGINE_SUBSTITUTION'
然后,重启Mysql服务就可以解决了!

 

This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its de 错误解决办法

是我们开启了bin-log, 我们就必须指定我们的函数是否是
1 DETERMINISTIC 不确定的
2 NO SQL 没有SQl语句,当然也不会修改数据
3 READS SQL DATA 只是读取数据,当然也不会修改数据
4 MODIFIES SQL DATA 要修改数据
5 CONTAINS SQL 包含了SQL语句

其中在function里面,只有 DETERMINISTIC, NO SQL 和 READS SQL DATA 被支持。如果我们开启了 bin-log, 我们就必须为我们的function指定一个参数。


在MySQL中创建函数时出现这种错误的解决方法:
set global log_bin_trust_function_creators=TRUE;

 

DROP FUNCTION IF EXISTS `AddMinutes`;
DELIMITER ;;
CREATE DEFINER=`root`@`%` FUNCTION `AddMinutes`(actualDateTime datetime, minutesToAdd int) RETURNS datetime
BEGIN
    RETURN DATE_ADD(actualDateTime, INTERVAL minutesToAdd MINUTE);
END
;;
DELIMITER ;

 

转载于:https://www.cnblogs.com/xiaoruilin/p/8933671.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值