Chinaunix首页 | 论坛 | 博客
  • 博客访问: 517895
  • 博文数量: 137
  • 博客积分: 3170
  • 博客等级: 中校
  • 技术积分: 1455
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-17 11:47
文章分类

全部博文(137)

文章存档

2015年(2)

2013年(1)

2012年(6)

2011年(5)

2010年(62)

2009年(61)

我的朋友

分类: Mysql/postgreSQL

2010-05-17 17:23:18

因为要使用sql-bench,所以先要安装perl的DBI和DBD
1.perlDBI---DBI-1.610_92.tar.gz
注:也可以通过网络安装perl -MCPAN -e shell

安装直接看README即可,我这里make test出现这个错误不知道什么原因
Failed 4/134 test scripts, 97.01% okay. 0/5073 subtests failed, 100.00% okay.
make: *** [test_dynamic] Error 255
但是还是能够用的,运行了一个小脚本,可以执行。
2.DBD-mysql-4.013.tar.gz安装,
执行时注意
unset LANG
perl Makefile.PL --mysql_config=/your/path/to/mysql_config
#或者直接做软链接到常规bin路径下也可以。
make
make test
make install

#!/usr/bin/perl

# PERL MODULES WE WILL BE USING
use DBI;
use DBD::mysql;

# HTTP HEADER
print "Content-type: text/html \n\n";

# CONFIG VARIABLES
$platform = "mysql";
$database = "mydb";
$host = "192.168.0.36";
$port = "3308";
$tablename = "test_table";
$user = "root";
$pw = "root";

#DATA SOURCE NAME
$dsn = "dbi:mysql:$database:192.168.0.36:3308";

# PERL DBI CONNECT
$DBIconnect = DBI->connect($dsn, $user, $pw);

3.注意,安装好后在mysql的源码包中有sql-bench,如果源码包没有进行过configure和make,那么
执行perl run-all-tests --help时,会出现如下错误:
Can't open perl script "run-all-tests": No such file or directory或
Can't exec @PERL@ at run-all-tests.sh line 1。
所以直接解压的源码包还是不能直接用的。

阅读(3009) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~