写在之前
从5.1切换到5.7,主要由mysql-server、mysql-devel、mysql-libs三部分
成功安装后:
-bash-4.1$ mysql -V
mysql Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using EditLine wrapper
JSON类型测试
perl客户端测试clob类型
需要安装DBI和DBD-mysql,可以打成绿色包以后免安装可直接解压使用。
#CREATE TABLE person (
#number INT(11) auto_increment primary key,
#name VARCHAR(255),
#birthday DATE,
#description LONGTEXT);
require("MysqlPub.pl");
my $dbh = &dbCon("MysqlPub");
#插入clob字段和日期字段
my $statement = "insert into person(name,birthday,description) values(?,'1983-11-23 00:00:00','跑步跳高')";
my $UpdLog = $dbh->prepare($statement);
my $result = $UpdLog->execute('liyr');
#查看插入信息
my $sth = $dbh->prepare("SELECT * FROM person");
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
print "Found a row: number = $ref->{'number'}, name = $ref->{'name'}, birthday = $ref->{'birthday'}, description = $ref->{'description'}\n";
}
$sth->finish();
#doselect测试
$statement = "SELECT name FROM person";
$sth = &doselect($dbh, $statement);
while(my $ref = $sth->fetchrow_arrayref()){
my $name = $ref->[0];
print "doselect test name : $name\n";
}
$sth->finish();
$dbh->disconnect();
golang客户端
使用_ "github.com/go-sql-driver/mysql"包,代码也很简单就不贴了。。
有疑问加站长微信联系(非本文作者)