ODBC 5.1 connection string for MySQL with read-only access

只谈情不闲聊 提交于 2019-12-07 21:45:03

问题


I have read-access to a MySQL database and am trying to connect to it via the MySql ODBC 5.1 driver. I'm getting an authorization failure (401) from the server. The administrator set up my access as follows:

mysql> grant select, create temporary tables on theDatabase.* to 'adrian' identified by 'password';

I am successful in connecting to the database using tools like dbvisualizer.

The connection string I'm trying to use in C#.NET is as follows:

"Driver={MySQL ODBC 5.1 Driver};Server=theDatabaseServer;Database=theDatabase;User=adrian;Password=password;Option=3;"

Perhaps the problem is related to the inability to specify my limited authorization in the connection string? Any suggestions on how to get around this (without having to request full access to the db)?

And what is the magic in "Option=3" ... are there other options?

Thanks.


回答1:


Try for the user "uid" and for the password "pwd" in the query string. This should be a valid connection string:

string ConnectionString = @"driver={MySQL ODBC 3.51 Driver};server=localhost;database=books;uid=band;pwd=letmein;";


来源:https://stackoverflow.com/questions/654656/odbc-5-1-connection-string-for-mysql-with-read-only-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!