MySql.Server
MySql.Server copied to clipboard
"Table 'mysql.proc' doesn't exist" when creating stored procedure
Hello,
I tried to create a stored procedure and it gaves me the following error
2017-09-19T03:22:02.0367327Z ##[error]Error Message: 2017-09-19T03:22:02.0367327Z ##[error] Initialization method ControlAcceso.Models.BLL.Tests.DatabaseTests.TestInitialize threw exception. MySql.Data.MySqlClient.MySqlException: MySql.Data.MySqlClient.MySqlException: Table 'mysql.proc' doesn't exist. 2017-09-19T03:22:02.0367327Z ##[error]Stack Trace: 2017-09-19T03:22:02.0367327Z ##[error] at MySql.Data.MySqlClient.MySqlStream.ReadPacket() 2017-09-19T03:22:02.0367327Z ##[error] at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) 2017-09-19T03:22:02.0367327Z ##[error] at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId) 2017-09-19T03:22:02.0367327Z ##[error] at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) 2017-09-19T03:22:02.0367327Z ##[error] at MySql.Data.MySqlClient.MySqlDataReader.NextResult() 2017-09-19T03:22:02.0367327Z ##[error] at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) 2017-09-19T03:22:02.0367327Z ##[error] at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() 2017-09-19T03:22:02.0367327Z ##[error] at MySql.Data.MySqlClient.MySqlHelper.ExecuteNonQuery(MySqlConnection connection, String commandText, MySqlParameter[] commandParameters) 2017-09-19T03:22:02.0377323Z ##[error] at MySql.Data.MySqlClient.MySqlHelper.ExecuteNonQuery(String connectionString, String commandText, MySqlParameter[] parms) 2017-09-19T03:22:02.0377323Z ##[error] at ControlAcceso.Models.BLL.Tests.DatabaseTests.LevantarInstanciaMySQL() in d:\a\1\s\src\ControlAccesos\ControlAccesos.Tests\Database\DatabaseTests.cs:line 233 2017-09-19T03:22:02.0377323Z ##[error] at ControlAcceso.Models.BLL.Tests.DatabaseTests.TestInitialize() in d:\a\1\s\src\ControlAccesos\ControlAccesos.Tests\Database\DatabaseTests.cs:line 216
This is how I try to create it. The first two scripts are the ones that create the database and insert records in it
` MySqlServer dbServer = MySqlServer.Instance; dbServer.StartServer();
//Creo la DB y la selecciono
MySqlHelper.ExecuteNonQuery(dbServer.GetConnectionString(), string.Format("CREATE DATABASE {0};USE {0};", TestDatabase));
//Ejecuto los scripts para crear las tablas llenarla de datos
string directorio = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
MySqlHelper.ExecuteNonQuery(dbServer.GetConnectionString(), File.ReadAllText(directorio + @"\..\ControlAccesos\Models\ControlAccesos.edmx.sql"));
MySqlHelper.ExecuteNonQuery(dbServer.GetConnectionString(), File.ReadAllText(directorio + @"\..\Scripts DB\Inserts.sql"));
MySqlHelper.ExecuteNonQuery(dbServer.GetConnectionString(), File.ReadAllText(directorio + @"\..\Scripts DB\SP_ValidarAcceso.sql"));`
Thanks
I got the exact same problem while trying a procedure.
I've forked the repo with a fix for this (https://github.com/williamlindsay/MySql.Server). The solution involved updating MySQL to 5.7.20 and use the initialization process to setup those base tables which wouldn't be there otherwise. All that is needed is to set the new initialize flag to true when calling StartServer. That said, it does slow the process down so I would recommend to only run StartServer once per full test suite execution and clear the tables in between tests instead.
Has there been any change on this issue, it still seems broken in the same way on 1.1 ?