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;
相关文档:
先用root登陆mysql -u root -p
mysql>show databases;
mysql>use mysql;
update user set password=password('你想设置的密码')
where user='root'; ......
/**********************by garcon1986***************************************/
错误代码如下:
#1045 - Access denied for user 'root'@'localhost' (using password: YES)
$cd /etc/mysql
$mysql -u root -p
出现错误#1045
尝试了很多方法后,在网络上找到了解决方法。
$cd /etc/mysql
$gedit debian.cnf
找到 ......
我的环境:
原有一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 ......
用MYSQL语句:
mysql -uroot -p^^^^^ -e "select * from test.table2" > d:\a.xls
其中test为数据库 table2为其中的表 d:\a.xls为表位置 ......
显示、设置自动提交 show variable like 'autocommit' set autocommit=1 or 0
设置日志:
在/etc/mysql/my.cnf中设置如下可再slow.log中输出运行时间超过一秒的sql语句
[mysqld]
log-slow-queries = /tmp/slow.log
long_query_time = 1
设置日志输出运行超过1秒的sql语句 set global long_query_ti ......