免费注册 查看新帖 |

Chinaunix

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

perl 在windows上如何访问Mysql [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-04-06 22:13 |只看该作者 |倒序浏览
请教配置问题,DBI在哪里安装?

论坛徽章:
0
2 [报告]
发表于 2007-04-06 22:26 |只看该作者
ppm> install DBD::Mysql

or

install CPAN
perl -MCPAN -e shell
cpan> install DBD::Mysql

[ 本帖最后由 xiaoquqi 于 2007-4-7 15:21 编辑 ]

论坛徽章:
0
3 [报告]
发表于 2007-04-07 13:00 |只看该作者
使用PPM安装 DBI ,  DBD::mysql 也可

论坛徽章:
0
4 [报告]
发表于 2007-04-07 14:58 |只看该作者

谢谢大家

C:\Perl\bin>dir ppm*
驱动器 C 中的卷没有标签。
卷的序列号是 7C0C-070A

C:\Perl\bin 的目录

2007-01-22  15:29            50,348 ppm
2007-01-09  22:54               503 ppm-shell
2007-01-23  16:39               905 ppm-shell.bat
2007-01-23  16:39            50,750 ppm.bat
               4 个文件        102,506 字节
               0 个目录 13,339,570,176 可用字节

C:\Perl\bin>ppm-shell
ppm 4.01
Copyright (C) 2007 ActiveState Software Inc.  All rights reserved.
ppm> install mysql
Downloading ActiveState Package Repository packlist...not modified
ppm install failed: Can't find any package that provide mysql
ppm>

论坛徽章:
0
5 [报告]
发表于 2007-04-07 15:00 |只看该作者
貌似不太对头,目前只好c来调用mysql api,请帮忙再指点一下

论坛徽章:
0
6 [报告]
发表于 2007-04-07 15:20 |只看该作者
原帖由 chaoscy 于 2007-4-7 15:00 发表
貌似不太对头,目前只好c来调用mysql api,请帮忙再指点一下

你试试 install DBD::Mysql吧

或者 可以这样

C:\Documents and Settings\admin>perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support enabled


cpan> install Mysql
CPAN: Storable loaded ok
Going to read D:\Perl\cpan\Metadata
  Database was generated on Mon, 02 Apr 2007 10:09:51 GMT
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
  http://ppm.activestate.com/CPAN/authors/01mailrc.txt.gz
Going to read D:\Perl\cpan\sources\authors\01mailrc.txt.gz
Fetching with LWP:
  http://ppm.activestate.com/CPAN/modules/02packages.details.txt.gz
Going to read D:\Perl\cpan\sources\modules\02packages.details.txt.gz
  Database was generated on Fri, 06 Apr 2007 11:09:51 GMT

  There's a new CPAN.pm version (v1.8802) available!
  [Current version is v1.7602]
  You might want to try
    install Bundle::CPAN
    reload cpan
  without quitting the current session. It should be a seamless upgrade
  while we are running...

Fetching with LWP:
  http://ppm.activestate.com/CPAN/modules/03modlist.data.gz
Going to read D:\Perl\cpan\sources\modules\03modlist.data.gz
Going to write D:\Perl\cpan\Metadata
Mysql is up to date.


cpan>

[ 本帖最后由 xiaoquqi 于 2007-4-7 15:22 编辑 ]

论坛徽章:
0
7 [报告]
发表于 2007-04-07 21:47 |只看该作者
严重感谢啊,xd
--------------------------------------
  CPAN.pm: Going to build C/CA/CAPTTOFU/DBD-mysql-3.0008.tar.gz

Failed to determine directory of mysql.h. Use

  perl Makefile.PL --cflags=-I<dir>

to set this directory. For details see the INSTALL.html file,
section "C Compiler flags" or type

  perl Makefile.PL --help
Running make test
  Make had some problems, maybe interrupted? Won't test
Running make install
  Make had some problems, maybe interrupted? Won't install
-----------------------------------------------------------------------------------------------------------

我敲入

C:\Perl\bin> perl Makefile.PL --cflags=-ID:\Projects\MySQL\include
Can't open perl script "Makefile.PL": No such file or directory

于是

C:\Perl\cpan\build\DBD-mysql-3.0008> perl Makefile.PL --cflags=-ID:\Projects\MySQL\include -L D:\Projects\MySQL\lib\opt\

I will use the following settings for compiling and testing:

  cflags        (User's choice) = -ID:\Projects\MySQL\include
  embedded      (guessed      ) =
  libs          (User's choice) = D:\Projects\MySQL\lib\opt\
  nocatchstderr (default      ) = 0
  nofoundrows   (default      ) = 0
  ssl           (guessed      ) = 0
  testdb        (default      ) = test
  testhost      (default      ) =
  testpassword  (default      ) =
  testsocket    (default      ) =
  testuser      (default      ) =

To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.

Checking if your kit is complete...
Looks good
Multiple copies of Driver.xst found in: C:/Perl/site/lib/auto/DBI/ C:/Perl/lib/auto/DBI/ at Makefile.PL line 727
Using DBI 1.54 (for perl 5.008008 on MSWin32-x86-multi-thread) installed in C:/Perl/site/lib/auto/DBI/
Writing Makefile for DBD::mysql

貌似成功了??

论坛徽章:
0
8 [报告]
发表于 2007-04-09 00:15 |只看该作者
原帖由 chaoscy 于 2007-4-7 21:47 发表
严重感谢啊,xd
--------------------------------------
  CPAN.pm: Going to build C/CA/CAPTTOFU/DBD-mysql-3.0008.tar.gz

Failed to determine directory of mysql.h. Use

  perl Makefile.PL --cfla ...

你用的方法太复杂了 呵呵 你让它自己装贝 用我说的方法 呵呵
或者你试试ppm-install
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP