diff --git a/Src/Asp.Net/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs b/Src/Asp.Net/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs index d32d130d1..ff1b03818 100644 --- a/Src/Asp.Net/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs +++ b/Src/Asp.Net/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.RegularExpressions; namespace SqlSugar { @@ -289,6 +290,7 @@ namespace SqlSugar } var oldDatabaseName = this.Context.Ado.Connection.Database; var connection = this.Context.CurrentConnectionConfig.ConnectionString; + Check.Exception(Regex.Split(connection,oldDatabaseName).Length > 2, "The user name and password cannot be the same as the database name "); connection = connection.Replace(oldDatabaseName, "mysql"); var newDb = new SqlSugarClient(new ConnectionConfig() {