mysql下的分页存储过程
CREATE PROCEDURE pro_page(
in _sql varchar(1000),
in _order varchar(1000),
in _pagecurrent int,
in _pagesize int
)
BEGIN
if _pagesize<=1 then
set _pagesize=20;
end if;
if _pagecurrent < 1 then
set _pagecurrent = 1;
end if;
set @strsql = concat(_sql,' ',_order,' limit ',_pagecurrent*_pagesize-_pagesize,',',_pagesize);
prepare stmtsql from @strsql;
execute stmtsql;
deallocate prepare stmtsql;
END;
相关文档:
我的环境:
原有一mysql5.0实例,现新安装一mysql5.1,并将新的5.1实例的数据路径放在另一目录。
mysql5.1的my.ini如下
(配置my.ini的参考资料:
http://dev.mysql.com/doc/refman/5.1/en/option-files.html
http://downloads.mysql.com/docs/mysql-windows-excerpt-5.1-en.pdf
http://dev.mysql.com/doc/refman/5.0 ......
cmd下切换到 mysql 安装目录
例
d:/mysql/bin (如果用WAMP安装则是D:\wamp\bin\mysql\mysql5.1.30\bin)
前提:mysql用户root密码为空.
输入 mysql -u root mysql
mysql> 状态下输入 update user set password=password('新密码') where user='root';
回显
Query OK, 0 rows ......
query_cache_min_res_unit 查询缓存分配的最小块的大小(字节)
query_alloc_block_size 为查询分析和执行过程中创建的对象分配的内存块大小
Qcache_free_blocks代表内存自由块的多少,反映了内存碎片的情况
==========================
1)当查询进行的时候,Mysql把查询结果保存在qurey ......
(1)INFORMATION_SCHEMA
select (sum(data_length) + sum(index_length))/(1024*1024) from INFORMATION_SCHEMA.`TABLES` where table_schema = 'your_table_schema' and table_name like 'your_table_name';
(2)show table status like '';
try {
Class.forName("com.mysql.jdbc.Driver");
......
#!/bin/bash
#删除100个数据库中的1000个表的过期数据
DBHOST="127.0.0.1"
DBPWD="pwd"
DBUSER="root"
MYSQLBIN="/usr/local/mysql/bin/mysql"
for((dbindex = 0;dbindex < 100;dbindex++))
do
for((tabindex = 0;tabindex < 10;tabindex++))
do
if [&n ......