使用 odbc 连接到在线 mysql 数据库,访问表时出现权限被拒绝错误
[mysqld-4.1.22-standard]SELECT command denied to user
'mydb_user'@'123.xxx.xxx.xxx' for table 'products'
我已经在远程主机中添加了访问在线数据库的 PC -- '123.xxx.xxx.xxx' ---,我是否需要在数据库上单独授予此 IP 的权限?但如何呢?
我已将所有权限授予数据库用户:mydb_user,方法是从我网站的 cpanel 将该用户添加到数据库中并授予他所有权限。
我能够成功连接到数据库,但是当我传递查询:SELECT * FROM PRODUCTS 时,它会给出上述错误。
即使我使用主登录(即我用来登录 CPANEL 的凭据)连接到数据库,它也会给出相同的错误............请帮助...... ...!!!!!
我从本地 C# WINFORM .NET 应用程序连接到我网站的在线 mysql 数据库,该应用程序使用:
OdbcConnection addprodConn = new OdbcConnection("Driver={MySQL ODBC 5.1 Driver};
uid=mydb_user;password=********;server=www.mywebsite.com;database=mydb;port=3306");
[mysqld-4.1.22-standard]SELECT command denied to user
'mydb_user'@'123.xxx.xxx.xxx' for table 'products'
I have added my PC from which am accessing the online database -- '123.xxx.xxx.xxx' --- in the REMOTE HOSTS also, do i need to give permission separately for this IP on the database? But how?
I have given all privileges to the database user: mydb_user by adding this user into the database from the cpanel of my website and granting him all the permissions.
I am able to connect to the database successfully, but when i pass a query : SELECT * FROM PRODUCTS, then it gives the above mentioned error.
Even if am connected to the database using THE MAIN LOGIN (i.e. THE CREDENTIALS WHICH I USE TO LOG INTO THE CPANEL) , then also , it gives the same error............Please help......!!!!!
Am connecting to the online mysql database of my website from a local C# WINFORM .NET APPLICATION which uses :
OdbcConnection addprodConn = new OdbcConnection("Driver={MySQL ODBC 5.1 Driver};
uid=mydb_user;password=********;server=www.mywebsite.com;database=mydb;port=3306");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法真正假设您的问题的解决方案,但您可以尝试调试它:
查看
mydb_user
在数据库上的权限是什么。使用这个sql语句我还建议使用像MySQL Workbench这样的实用工具来处理你的测试。
I can't really assume a solution to your problem, but you can try to debug it:
See what are the priviledges of
mydb_user
on the database. Use this sql statementAlso i recommend using a utility tool like MySQL Workbench for working with your testing.