执行mysql -e 时能否保持一个长连接?
我有时候在linux shell写些针对于mysql数据库的操作,shell脚本要多次运行mysql -e,但这样的话,每次都要连接数据库,很浪费资源,有没有办法维持一个长连接并以后一直用这个长连接呢?
没有
你还是把所有的语句一次性执行完比较方便。
想直接用mysql -e来保持长连接不可以
考虑别的方式吧
好
SQL code:
$ mysql test -e "select * from tb;desc user;show tables;"
+------+------+
| rid | con |
+------+------+
| 1 | NULL |
| 2 | NULL |
| 2 | NULL |
| 3 | NULL |
| 4 | NULL |
| 4 | NULL |
| 4 | NULL |
+------+------+
+----------+----------------------+------+-----+---------+-----------
| Field | Type | Null | Key | Default | Extra
+----------+----------------------+------+-----+---------+-----------
| userid | smallint(6) unsigned | NO | PRI | NULL | auto_incre
| username | varchar(20) | NO | | NULL |
+----------+----------------------+------+-----+---------+-----------
+---------------------------+
| Tables_in_test |
+---------------------------+
| a |
| animals |
| b |
| cmplcate |
| columns_priv |
| contest_skill |
| db |
| dd |
| event |
相关问答:
Winform+MySQL做项目,在注重性能的情况下,我该如何去完成这类型的项目呢!
请各位给以提示。
你这个范围太广了,我说2点重要的吧
1.WINFORM程序是单独运行的CS程序,和BS不同,BS的压力始终都在SERVER上的,对C ......
环境:win2003 apache2 resin3 php5 mysql5
mysql错误里出现这个,服务器直接死到那里。
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_log ......
select * from table where '123456789' like '%'+字段表+'%'
这句sql在sqlserver下通过,在mysql下有报错,mysql下如何实现这样的查询呢
SQL code:
select * from table whe ......
大家好:
我是搞C的, 现在想用C 连接MYSQL,但是怎么也连接不了,我的代码如下:
#include <stdio.h>
#include "C:\Program Files\MySQL\MySQL Server 5.0\include\mysql.h"
......
我用的like模糊查询,比如mysql的name中有“csdn论坛系统”这几个字,如何在 <input>中查询“csdn 系统”也能出来这个“csdn论坛系统”,我现在是查“csdn”或者“系统”都可以。谢谢各位了!不知道我这么表达 ......