摘要: 对于刚刚接触Linux的人来说,一定会给Linux下一大堆各式各样的文件名给搞晕。别个不说,单单就压缩文件为例,我们知道在Windows下最常见的压缩文件就只有两种,一是,zip,另一个是.rar。可是Linux就不同了,它有.gz、.tar.gz、tgz、bz2、.Z、.tar等众多的压缩文件名... 阅读全文
posted @ 2016-01-18 09:53 泽锦 阅读(6758) 评论(0) 推荐(0) 编辑
摘要: 当我们在一个数据库修改完备注后,需要将其导致另一个服务器上的数据库中,需要生成批量执行语句,方便操作,注意用change 或modified 进行列的属性修改时,没有写全的话会造成其它属性的丢失,如t_users 表中有字段 name 备注名为 姓名,默认值为0,如果用alter table t_u... 阅读全文
posted @ 2016-01-15 17:31 泽锦 阅读(3461) 评论(0) 推荐(0) 编辑
摘要: a=$(cat 1.sh)等价于a=`cat 1.sh`而a=(cat 1.sh) 相当于定义一个a数组,内容为cat 1.sha=(`cat 1.sh`)相当于把1.sh里面的内容当成a的数组,a仍旧是一个数组a=$(`cat 1.sh`)此命令会报错,不能执行[root@zejin240 che... 阅读全文
posted @ 2016-01-15 08:58 泽锦 阅读(343) 评论(0) 推荐(0) 编辑
摘要: CREATE TABLE `t1` ( `id` int(11) NOT NULL DEFAULT '0', `name` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB transaction 1 mysql> select  阅读全文
posted @ 2015-12-29 10:29 泽锦 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 首先创建一个表:CREATE TABLE `t1` (`id` INT(11) NULL DEFAULT NULL,`name` VARCHAR(20) NULL DEFAULT NULL)插入几条数据:mysql> select * from t1;+------+------+| id | ... 阅读全文
posted @ 2015-11-18 13:30 泽锦 阅读(9132) 评论(0) 推荐(2) 编辑
摘要: 以下两条语句是否可以合并成一条:update t9 set id=1 where b>'2015-10-12'; update t9 set id=1, e='2015-01-01' where b='2015-10-12'; 既然来写博客了,那答案肯定是可以的,如下写法可以就上面的两条up... 阅读全文
posted @ 2015-11-06 15:28 泽锦 阅读(6351) 评论(0) 推荐(0) 编辑
摘要: 月度利息统计sql优化原因:写的sql语句复杂,理解起来有难度,另一方面,查询性能比较低原来的语句如下:SELECTtp.year,tp.month,tp.bid_id,b.`title`,DATE(b.`time`) `time`, tp.receive_date,u.`name`, u.`rea... 阅读全文
posted @ 2015-11-06 12:36 泽锦 阅读(467) 评论(0) 推荐(0) 编辑
摘要: 清空具有外键约束的表时报ERROR 1701(42000)的解决mysql> truncate table t_users;ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint (`tes... 阅读全文
posted @ 2015-11-03 15:10 泽锦 阅读(1495) 评论(0) 推荐(0) 编辑
摘要: 只导表结构完整语句: mysqldump -h192.168.1.174 --port=3306 -uroot -p --routines --events --no-data --no-create-db test>test_s.sql 导出表数据完整语句(有二进制日志的时候): mysqldum 阅读全文
posted @ 2015-11-02 15:32 泽锦 阅读(275) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bashfor i in `seq 1 254`do{ping -c2 192.168.1.$i &>/dev/nullif [ $? != 0 ];thenecho "192.168.1.$i is not used"fi}done 阅读全文
posted @ 2015-10-30 11:08 泽锦 阅读(550) 评论(0) 推荐(0) 编辑