MemSQL:错误 1049 - 执行过程时

MemSQL : Error 1049 - while executing procedure

我正在学习 MemSQL,作为其中的一部分,我试图从 C# 客户端代码执行一个过程。存储过程存在于 MemSQL 数据库中。但是,我收到错误 "Error 1049 has occurred: unknown database 'mysql'"。 这个问题只针对一个过程,如果我从 C# 客户端执行一个简单的查询,它工作正常。

我正在使用 MySql.Data.MySqlClient .Net Core Class 库 6.8.8。

尝试将连接选项 CheckParameters 设置为 false。

.NET MySQL 驱动程序尝试查询 mysql 数据库以获取有关存储过程参数的信息,这不适用于 MemSQL。

来自 https://dev.mysql.com/doc/connector-net/en/connector-net-programming-stored.html(存档):

When you call a stored procedure (in versions before the MySQL 8.0 release series), the command object makes an additional SELECT call to determine the parameters of the stored procedure. You must ensure that the user calling the procedure has the SELECT privilege on the mysql.proc table to enable them to verify the parameters. Failure to do this will result in an error when calling the procedure.

这是默认行为,但可以使用连接选项进行更改:

来自 https://dev.mysql.com/doc/connector-net/en/connector-net-6-10-connection-options.html(存档):

CheckParameters , Check Parameters

Default: true

Indicates if stored routine parameters should be checked against the server.

旧版本客户端的此选项:

UseProcedureBodies , Use Procedure Bodies , procedure bodies

Default: true

When set to true, the default value, Connector/NET expects the body of the procedure to be viewable. This enables it to determine the parameter types and order. Set the option to false when the user connecting to the database does not have the SELECT privileges for the mysql.proc (stored procedures) table or cannot view INFORMATION_SCHEMA.ROUTINES, and then explicitly set the types of all the parameters before the call and add the parameters to the command in the same order as they appear in the procedure definition.

This option was deprecated in Connector/NET 6.3.7 and removed in Connector/NET 6.10.4; use the Check Parameters option instead.