包含mysql 递归查询父节点 和子节点 mysql递归查询,查父集合,查子集合 查子集合 --drop FUNCTION `getChildList` CREATE FUNCTION `getChildList`(rootId varchar()) RETURNS varchar() BEGIN DECLARE str varchar(); DECLARE cid varchar(); SET str = '$'; SET cid = rootId; WHILE cid is not null
MySQL 清理slowlog方法 SET GLOBAL slow_query_log = 'OFF'; ALTER TABLE mysql.slow_log RENAME mysql.slow_log_drop; CREATE TABLE mysql.slow_log LIKE mysql.slow_log_drop; SET GLOBAL slow_query_log = 'ON'; DROP TABLE mysql.slow_log_drop;
use ZooKeeper; use AnyEvent; use AE; use Data::Dumper; use IO::Socket; my $zk = ZooKeeper->new(hosts => '120.55.118.6:2181'); my $stat = $zk->exists('/mysql'); unless ($stat){ $zk->create('/mysql'); } my $created_path = $zk->create('/mysql/
一.清除原因 因为之前打开了慢查询,导致此表越来越大达到47G,导致磁盘快被占满,使用xtrabackup进行备份的时候文件也超大. mysql> show variables like 'log_output%'; Connection id: Current database: mysql +---------------+-------+ | Variable_name | Value | +---------------+-------+ | log_output | TABLE | +
1.表结构 CREATE TABLE folder( id BIGINT(20) NOT NULL, parent_id BIGINT(20) DEFAULT NULL, PRIMARY KEY id ); 2.根据传入id查询所有子节点及其的id 创建函数: CREATE FUNCTION `getParList`(rootId BIGINT) RETURNS varchar(1000) BEGIN DECLARE sTemp VARCHAR(1000); DECLARE s
根据id查询父节点,具体需要修改的地方笔者已在注释中给大家作了注解 DELIMITER $$ USE `yjlc_platform`$$ -- getCompanyParent 为函数名 DROP FUNCTION IF EXISTS `getCompanyParent`$$ -- getCompanyParent 为函数名 rootId为参数,可以自定义:初学者可以不用更改 )) ) CHARSET utf8 BEGIN ); ); SET ptemp = '#'; SET ctemp = r
关闭指定ip的连接: for i in $(mysql -uusername -ppassword -Bse "select * from information_schema.processlist where HOST like 'ip_addr%'" | awk '{print $1}');do mysql -uusername -ppassword -e "kill $i";done 下文摘自:mysql 清除连接 清除所有连接 for i in $(My
摘自:http://blog.chinaunix.net/uid-31401119-id-5781305.html 1 Flush tables简介 官方手册中关于Flush tables的介绍, Closes all open tables, forces all tables in use to be closed, and flushes the query cache. FLUSH TABLES also removes all query results from the query
查父集合 --drop FUNCTION `getParentList` )) ) BEGIN ) default ''; ) default rootId; WHILE rootId is not null do SET fid =(SELECT parentid FROM treeNodes WHERE id = rootId); IF fid is not null THEN SET str = concat(str, ',', fid); SET rootId = fid; ELSE S