"MySqlException: Table 'mysql.proc' doesn't exist" when executing MySQL stored procedures in .NET Core
I am using the ADO.NET data provider
MySql.Data.MySqlClient to access a MySQL database from .NET Core and most things work, but whenever I try to access a stored procedure I see the following exception message:
MySql.Data.MySqlClient.MySqlException : Table 'mysql.proc' doesn't exist
All of the articles I can find recommend running
mysql_upgrade to fix the system tables, but this finds no problems.
And in fact the database does not contain a
mysql.proc table - but it is not supposed to since it is MySQL 8.0!
I've installed the latest version of Connector/NET (8.0.15) using MySQL Installer.
What am I doing wrong?
The version of Connector/NET installed is... irrelevant!
This is .NET Core, and ADO.NET data providers for .NET Core are obtained via NuGet - so make sure that your .NET Core project is loading the latest version of the
MySql.Data NuGet package.
Older versions of the
MySql.Data NuGet package (pre v.8) do give the above error when trying to access stored procedures on version 8+ MySQL databases.
If you still face the issue after getting the latest version of MySql.Data package(s), make sure to add CheckParameters=false
Check out the GetSchema function in ADO.Net in particular the "Procedures" and "Procedure Parameters" collections.
I know this post is old, but in case this is question is still relevant... I was able to get around this issue by changing the command type to text instead of a stored procedure and on the command text I used the call command:
sql = "call yourstoreproc()"; cmd = new Mysql.Data.MySqlClient.MySqlCommand(sql, connection); cmd.CommandType = System.Data.CommandType.Text; cmd.ExecuteNonQuery();
- Hi Kenneth, I was just wondering, does updating
MySql.Datanot fix it? (It's always a shame to have to use work-arounds if avoidable - and this functionality definitely should work - although it's always good to know what the work-arounds are if necessary, too!)