****mysql——>shell
#!/bin/bash
mysql -uroot -ppassword <<EOM //进入mysql命令模式
use databasename;
create table tablename ( name VARCHAR(100) NOT NULL , id INT(32) NOT NULL,PRIMARY KEY (`id`) ) ENGINE=MYISAM; //创建表,表明字段名不需要引号。
select name,password,age,number FROM tablename into outfile '/tmp/userlist.txt'; //查询表内容输出到文件
update tablename set enabledo=0 where id="$1"; //更新表内容
EOM
犯的错误:表明和字段名在上面语句中加了引号或``导致语法错误。
****mysql——>perl
use DBI;
my $conn = DBI->connect( " DBI:mysql:database=databasename:host=127.0.0.1 ", "root","password",{ ' RaiseError ' => 1} ); //mysql连接句柄
my $sql = sprintf( " insert into tablename(id,name,age,sex,class) values('%d','%s','%d','%s','%s'); ", $id,$name,$age,$sex,$class ); //要执行的语句 可以根据需要换成update,select等等
my $result = $conn->do($sql); //运行sql变量语句
my $result = $conn->quote($ziduan); //这句shi什么意思
my $exec = $conn->prepare($update); //这句shi什么意思
$exec->execute(); //还有这个
$exec->finish(); //还有这个
my $result = $conn->disconnect(); //断开连接
****memcached——>shell
****memcached——>perl
my $memd = new Cache::memcached{ ' servers ' => [ ' 127.0.0.1:11211 ' ] }; //连接memcache库句柄
$result = $memd->get( " memcache_key " ); //获得memcache_key的值
$memd->delete( " memcache_key " ); //删除memcache_key字段
未完待续...