不是你常用的 MySQL4 + ODBC 连接问题
我遇到了一个 ODBC 问题,这让我很困惑,而且我无法在任何地方找到解决我的问题的答案。简短版本:我无法从我的 WinXP ODBC 系统 DNS 连接到 Ubuntu Jaunty 上安装的 MySQL4,即使我可以在该特定机器和其他机器上使用命令行客户端很好地连接。
大量的细节从这里开始!
我在 Ubuntu Jaunty 9.04 上安装了标准 MySQL5。我从 /usr/local/mysql4 中的预编译二进制文件手动安装了 MySQL4。启动命令如下:
/usr/local/mysql4/bin/mysqld_safe --user=mysql4 --port=3307 --socket=/var/run/mysql4d/mysql4d.sock --basedir='/usr/share/mysql4 /' --datadir='/var/lib/mysql4/' --log-error='/var/log/mysql4.err' --log='/var/log/mysql4.log' --language=' /usr/local/mysql-standard-4.1.22-pc-linux-gnu-i686-glibc23/share/mysql/english' &
这看起来效果很好。我使用 mysql 客户端从本地主机或通过 TCP/IP 的远程计算机进行连接没有任何问题:
mysql -u inContact -h myhost.com --password='blah' --port=3307
在同一台服务器上,我有运行 XP Pro 的虚拟机。我还可以在命令行上使用 mysql 连接无问题。但是,对 ODBC 系统 DSN 使用相同的设置不起作用。我收到消息“主机‘myhost.com’不允许连接到此 MySQL 服务器”。
我看到的唯一消息是在 mysql4.log 中:
091124 10:56:50 5 Connect inContact 上的[电子邮件受保护]
有人有一些见解吗?我在这里完全不知所措......
I've got a problem with ODBC that has me stumped, and I can't find an answer anywhere that addresses my problem. Short version: I can't connect to my MySQL4 installation on Ubuntu Jaunty from my WinXP ODBC System DNS, even tho I can connect just fine using the command line client both on that particular machine and others.
Huge amount of details starts here!
I have a standard MySQL5 install on Ubuntu Jaunty 9.04. I manually installed MySQL4 from precompiled binaries in /usr/local/mysql4. Here's the startup command:
/usr/local/mysql4/bin/mysqld_safe --user=mysql4 --port=3307 --socket=/var/run/mysql4d/mysql4d.sock --basedir='/usr/share/mysql4/' --datadir='/var/lib/mysql4/' --log-error='/var/log/mysql4.err' --log='/var/log/mysql4.log' --language='/usr/local/mysql-standard-4.1.22-pc-linux-gnu-i686-glibc23/share/mysql/english' &
This seems to work quite well. I have no problems connecting using the mysql client from either localhost or from a remote machine over TCP/IP:
mysql -u inContact -h myhost.com --password='blah' --port=3307
On this same server, I have virtualbox running XP Pro. I can also connect no probs using mysql on the command line from it. However, using the same settings for the ODBC system DSN don't work. I get the message "Host 'myhost.com' is not allowed to connect to this MySQL server".
The only message I'm seeing about it is in mysql4.log:
091124 10:56:50 5 Connect [email protected] on inContact
Anyone have some insight? I'm totally at a loss here...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要向要连接的用户授予权限。使用 GRANT 语句。
You need to give permissions to the user you want to connect with. Use the GRANT statement.
应该提到特权已经被授予,抱歉!
事实证明,问题是 mysql.user 和 mysql.db 表损坏。修复表没有成功,所以我尝试删除大多数记录,然后修复表(有效),然后重新添加用户和授予。之后工作了:)
Should have mentioned that privs were GRANTed already, sorry!
The issue turned out to be corrupted mysql.user and mysql.db tables. Repairing the tables wasn't successful, so I tried dropping most records and then repairing the table (which worked) and then re-added the users and GRANTs. Worked after that :)