diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs index 3d63ec00c..1eb00f8e4 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs @@ -393,7 +393,8 @@ namespace SqlSugar } public virtual bool IsAnyIndex(string indexName) { - string sql = string.Format(this.IsAnyIndexSql, indexName); + //string sql = string.Format(this.IsAnyIndexSql, indexName); + string sql = string.Format(this.IsAnyIndexSql, indexName, this.Context.Ado.Connection.Database); return this.Context.Ado.GetInt(sql)>0; } public virtual bool AddRemark(EntityInfo entity) diff --git a/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs b/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs index 763ce6b09..38d043d83 100644 --- a/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs +++ b/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs @@ -269,7 +269,7 @@ namespace SqlSugar { get { - return "SELECT count(*) FROM information_schema.statistics WHERE index_name = '{0}'"; + return "SELECT count(*) FROM information_schema.statistics WHERE index_name = '{0}' and index_schema = '{1}'"; } } #endregion