免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6885 | 回复: 9
打印 上一主题 下一主题

windows连接linux的mysql怎么联? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-05-26 16:50 |只看该作者 |倒序浏览
如题?大哥,大姐帮帮忙!

论坛徽章:
0
2 [报告]
发表于 2006-05-26 16:59 |只看该作者
mysql服务器是linux吗?。

论坛徽章:
0
3 [报告]
发表于 2006-05-26 17:00 |只看该作者

回复 2楼 yttlovezxx 的帖子

应该是啵,“连接linux的mysql”

论坛徽章:
0
4 [报告]
发表于 2006-05-26 17:07 |只看该作者
mysql administrator

论坛徽章:
0
5 [报告]
发表于 2006-05-26 17:18 |只看该作者
你是要怎么连阿,说得不清楚,用mysql客户端还是自己写程序?

论坛徽章:
0
6 [报告]
发表于 2006-05-28 09:36 |只看该作者
ODBC,JDBC都可以试试

论坛徽章:
0
7 [报告]
发表于 2006-05-28 10:20 |只看该作者
原帖由 okchina 于 2006-5-28 09:36 发表
ODBC,JDBC都可以试试


异地连接吗?

论坛徽章:
0
8 [报告]
发表于 2006-05-29 09:13 |只看该作者
对!

论坛徽章:
0
9 [报告]
发表于 2006-05-29 10:11 |只看该作者
原帖由 okchina 于 2006-5-29 09:13 发表
对!


如果是用程序连接:
1 在目标数据库里设置账户和密码:username,password
2 如果是用JAVA程序连接,这样写
url="jdbc:mysql://目的主机IP:3306/dbanme?useUnicode=ture&characterEncoding=gbk"
DriverManager.getConnection(url,username,password);
如果是通过客户端软件连接就在客户端界面工具里设置就OK了

[ 本帖最后由 xxjoyjn 于 2006-5-29 10:12 编辑 ]

论坛徽章:
0
10 [报告]
发表于 2006-06-28 10:40 |只看该作者
我也遇到了这个问题。
我在windows下的PHP服务器放置php文件用于连接另一台FreeBSD下的MySQL数据库。但是提示如下:

  1. Could not connect: Can't connect to MySQL server on 'mail.kinca.cn' (10061)
复制代码

这个错误是由于我在my.cnf中增加了bind_address=127.0.0.1的字段引起的,但是我注释掉这个字段后,依旧出现其他的错误

  1. Could not connect: Host '220.191.161.67' is not allowed to connect to this MySQL server
  2. 其中220.191.161.67是windows机器的IP.
复制代码

请问我要修改什么属性,才能成功连接FreeBSD下的MySQL数据库?


  1. 连接代码:
  2. $link = mysql_connect('mail.kinca.cn', 'xxx', 'yyyyyyyyy')
  3.     or die('Could not connect: ' . mysql_error());
复制代码


  1. #my.cnf
  2. # Example MySQL config file for small systems.
  3. #
  4. # This is for a system with little memory (<= 64M) where MySQL is only used
  5. # from time to time and it's important that the mysqld daemon
  6. # doesn't use much resources.
  7. #
  8. # You can copy this file to
  9. # /etc/my.cnf to set global options,
  10. # mysql-data-dir/my.cnf to set server-specific options (in this
  11. # installation this directory is /var/db/mysql) or
  12. # ~/.my.cnf to set user-specific options.
  13. #
  14. # In this file, you can use all long options that a program supports.
  15. # If you want to know which options a program supports, run the program
  16. # with the "--help" option.

  17. # The following options will be passed to all MySQL clients
  18. [client]
  19. #password        = your_password
  20. port                = 3306
  21. socket                = /tmp/mysql.sock

  22. # Here follows entries for some specific programs

  23. # The MySQL server
  24. [mysqld]
  25. port                = 3306
  26. socket                = /tmp/mysql.sock
  27. skip-locking
  28. key_buffer = 16K
  29. max_allowed_packet = 1M
  30. table_cache = 4
  31. sort_buffer_size = 64K
  32. read_buffer_size = 256K
  33. read_rnd_buffer_size = 256K
  34. net_buffer_length = 2K
  35. thread_stack = 64K
  36. bind_address=127.0.0.1
  37. log=/var/log/sql.log

  38. # Don't listen on a TCP/IP port at all. This can be a security enhancement,
  39. # if all processes that need to connect to mysqld run on the same host.
  40. # All interaction with mysqld must be made via Unix sockets or named pipes.
  41. # Note that using this option without enabling named pipes on Windows
  42. # (using the "enable-named-pipe" option) will render mysqld useless!
  43. #
  44. #skip-networking
  45. server-id        = 1

  46. # Uncomment the following if you want to log updates
  47. #log-bin=mysql-bin

  48. # Uncomment the following if you are NOT using BDB tables
  49. #skip-bdb

  50. # Uncomment the following if you are using InnoDB tables
  51. #innodb_data_home_dir = /var/db/mysql/
  52. #innodb_data_file_path = ibdata1:10M:autoextend
  53. #innodb_log_group_home_dir = /var/db/mysql/
  54. #innodb_log_arch_dir = /var/db/mysql/
  55. # You can set .._buffer_pool_size up to 50 - 80 %
  56. # of RAM but beware of setting memory usage too high
  57. #innodb_buffer_pool_size = 16M
  58. #innodb_additional_mem_pool_size = 2M
  59. # Set .._log_file_size to 25 % of buffer pool size
  60. #innodb_log_file_size = 5M
  61. #innodb_log_buffer_size = 8M
  62. #innodb_flush_log_at_trx_commit = 1
  63. #innodb_lock_wait_timeout = 50

  64. [mysqldump]
  65. quick
  66. max_allowed_packet = 16M

  67. [mysql]
  68. no-auto-rehash
  69. # Remove the next comment character if you are not familiar with SQL
  70. #safe-updates

  71. [isamchk]
  72. key_buffer = 8M
  73. sort_buffer_size = 8M

  74. [myisamchk]
  75. key_buffer = 8M
  76. sort_buffer_size = 8M

  77. [mysqlhotcopy]
  78. interactive-timeout

  79. [maxconnections]
  80. max_connections=1024

复制代码


已经解决:进入MYSQL的用户表,为要使用的用户添加权限。
grant all privileges on *.* to root@"%";
flush privileges;

[ 本帖最后由 sunable 于 2006-6-28 11:28 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP