原文:http://www.cnblogs.com/tianhuilove/archive/2011/09/05/2167795.html
阅读全文 >>tee命令可以将mysql操作日志输出到指定文件中,如果文件已存在则追加。命令行参数可以使用–tee=file_path,命令中可以使用tee或\T,想要退出使用日志可以使用\t
1 | $ mysql -u root -p --tee=mysql.log |
1 | mysql> system uname; |
1 | mysql> source mysql.sql |
1 | mysql> prompt \u@\d> |
需要使用双引号括起来
1 | wxnacy@wxnacydeMacBook-Pro: ~ $ mysql -u root -p --prompt="\u@\d> " |
1 | wxnacy@wxnacydeMacBook-Pro: ~ $ export MYSQL_PS1="\u@\d> " |
也可以在配置中一劳永逸
1 | [mysql] |
1 | Option Description |
当使用命令 select 结果,如果表属性特别多的时候,查看起来非常难受,在 select 语句
后使用\G
(必须大写),可以让结果按行垂直显示
1 | mysql> select * from user\G; |
1 |
|
使用mysql客户端的参数–html或者-T,则所有SQL的查询结果会自动生成为html的table代码
1 | $ mysql -u root --html -p |
1 | <TABLE BORDER=1><TR><TH>id</TH><TH>name</TH><TH>is_del</TH><TH>create_ts</TH> <TH>update_ts</TH></TR><TR><TD>1</TD><TD>wxnacy</TD><TD>0</TD><TD>2017-08-08 07:46:42</TD><TD>2017-08-08 07:46:42</TD></TR></TABLE> |
使用mysql客户端的参数–xml或者-X选项,可以将结果输出为xml格式
1 | $ mysql -u root --xml -p |
1 | <?xml version="1.0"?> |
当select查询结果很多时,一屏幕往往无法装下。使用pager命令后在进行select命令,可以进入类似linux中more或less查看文件的效果
1 | mysql> pager more |
专辑:ansible学习笔记
Ansilbe 是一个部署一群远程主机的工具。远程的主机可以是远程虚拟机或物理机,也
可以是本地主机。Ansilbe 是一个部署一群远程主机的工具。远程的主机可以是远程虚拟机
或物理机,也可以是本地主机。
1 | pip install ansible |
修改/etc/ansible/hosts 全局hosts文件,没有的话自己创建
1 | [wxnacy] # 如果服务器使用密码登录就用这个方式保存密码,避免每次输入 |
1 | $ ansible all -m ping |
得到如上样式结果即为正确,另外执行 ansible wxnacy -m ping
可以针对某一个服务器
组进行操作
1 | $ ansible prod -m shell -a "uname -a" |
在一些项目中,全局hosts配置不能满足需求,需要指定hosts命令,可以执行如下命令
1 | ansible my -i hosts_path -m ping |
专辑:ansible学习笔记
Playbooks 是 Ansible的配置,部署,编排语言.他们可以被描述为一个需要希望远程主机执行命令的方案,或者一组IT程序运行的命令集合.
一个playbook就是一个YAML文件,所以playbook文件一般都以.yml结尾,一个playbook文件由一个或多个play组成,每个play定义了在一个或多个远程主机上执行的一系列的task,其中每个task一般就是调用一个ansible的模块,如调用copy模块复制文件到远程主机或调用shell模块执行命令。
配置deploy.yml完成进入远程服务器的某个目录并执行git pull操作
1 | - hosts: wxnacy # 它会默认使用/etc/ansible/hosts 中配置的服务器组名 也可以单独设置hosts地址 |
运行
1 | $ ansible-playbook deploy.yml |
执行完运行命令ansible会在webservers组中依次执行tasks,返回以上样式结果极为成功,结果通过红黄绿三种颜色标明了不同的执行结果,红色表示有task执行失败,黄色表示改变了远程主机状态。
今天目标创建acticle表,并完善
insert_comment_trigger
,以支持更新article中的comment_count,comment表新增comment_id字段
专辑:mysql每天练习
新建article
1 | drop table if exists `article`; |
修改insert_comment
1 | drop trigger if exists `insert_comment`; |
添加字段
1 | alter table comment add column comment_id int(11) not null default 0 comment '回复的评论注解id'; |
测试
1 | insert into article (name,url) values ('好文章','http://wen.com/wen.html'); |
执行完后,article中comment_count应该等于1
今天目标新建user、
user_data
表,并完善insert_commet_trigger
,达到根据判断resource_type来更新video还是user_data的comment_count
专辑:mysql每天练习
新建user表
1 | drop table if exists `user`; |
新建user_data表
1 | drop table if exists `user_data`; |
重写 insert_comment_trigger
1 | drop trigger if exists `insert_comment`; |
执行相关语句
1 | insert into user(name) values ('wxnacy'); |
执行语句后,user_data中comment_count应该等于2
今天的目标是新建一个video视频表和comment评论表,并编写trigger,达到当insert一条评论类型为video的数据到comment中时,video中comment_count字段可以自加一
专辑:mysql每天练习
新建video表
1 | drop table if exists `video`; |
添加comment_count字段(不是忘了,就是想练一下add column语句╭(╯^╰)╮)
1 | alter table video add column comment_count int(11) not null default 0 comment '评论数量'; |
新建comment表
1 | drop table if exists `comment`; |
新建trigger
1 | drop trigger if exists `insert_comment`; |
执行相应操作语句
1 | insert into video (name,url) values ('蜘蛛侠:返校季','http://woyemeiyou/wangzhi.mp4'); |
最后结果中video表中的comment_count应该等于1
tag:
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent: meta: false pages: false posts: title: true date: true path: true text: false raw: false content: false slug: false updated: false comments: false link: false permalink: false excerpt: false categories: false tags: true
2021-06-21
#python#py2
2021-06-13
#mongo
2021-06-13
#mac
2021-06-12
#shell
2021-06-09
#linux#jq
2021-06-06
#Mac#Homebrew
2021-06-06
#java
2021-04-17
#hexo
2020-10-08
#linux
2020-10-06
#vim
2020-10-03
#docker
2020-10-02
#python#chrome
2020-09-30
#docker
2020-09-30
#python
2020-09-26
#node
2020-09-07
#linux
2020-09-06
#python
2020-08-24
#hexo
2020-08-06
#excel
2020-08-01
#python
2020-07-30
#mysql
2020-07-23
#docker
2020-07-23
#微信
2020-07-20
#javascript
2020-07-18
#python#sqlalchemy
2020-07-18
#excel
2020-06-19
#windows
2020-06-13
#hexo#jupyter
2020-06-09
#python
2020-06-04
#ansible
2020-06-03
#mac
2020-06-02
#shell
2020-05-19
#python#flask
2020-05-16
#python
2020-05-02
#mysql
2020-05-01
#python
2020-04-18
#java
2020-04-11
#python
2020-04-01
#linux
2020-03-08
#shell
2020-03-07
#node
2020-03-06
#node
2020-02-14
#mac
2020-01-13
#shell
2020-01-09
#shell
2020-01-08
#mysql
2020-01-07
#shell
2019-12-26
#docker
2019-12-09
#ffmpeg
2019-12-05
#mysql
2019-11-19
#nginx
2019-11-12
#javascript
2019-10-28
#mac#vmware
2019-10-17
#nginx
2019-09-22
#工具
2019-09-19
#youtube
2019-09-18
#python#微信
2019-09-15
#python#工具
2019-09-09
#vmware
2019-09-08
#微信
2019-09-01
#chrome
2019-08-31
#python
2019-08-29
#python
2019-08-22
#docker
2019-08-21
#node
2019-08-20
#python
2019-08-15
#python
2019-08-12
#docker
2019-08-01
#mysql
2019-07-31
#vagrant#ansible
2019-07-30
#python
2019-07-27
#docker
2019-07-26
#docker
2019-07-22
#docker
2019-07-18
#vagrant
2019-07-17
#python
2019-07-16
#nginx
2019-07-13
#python
2019-07-12
#linux
2019-07-11
#linux
2019-07-10
#python
2019-07-08
#python
2019-06-25
#linux
2019-06-18
#linux
2019-06-16
#python
2019-06-12
#python
2019-06-07
#linux
2019-06-07
#python
2019-06-06
#http#linux
2019-06-04
#nginx
2019-06-03
#python#工具
2019-05-29
#java
2019-05-28
#算法
2019-05-27
#python
2019-05-25
#javascript
2019-05-21
#git
2019-05-20
#python
2019-05-19
#python
2019-05-17
#vim
2019-05-13
#python
2019-05-05
#python
2019-04-29
#linux
2019-04-28
#python
2019-04-26
#linux#awk
2019-04-25
#sqlalchemy
2019-04-24
#python
2019-04-23
#redis
2019-04-18
#vim
2019-04-17
#python
2019-04-16
#ffmpeg
2019-04-15
#vim
2019-04-14
#python#工具
2019-04-13
#linux
2019-04-12
#python
2019-04-11
#python
2019-04-09
#python
2019-04-08
#ffmpeg
2019-04-07
#python
2019-04-06
#python
2019-04-05
#expect
2019-04-04
#zsh
2019-04-03
#mac
2019-04-02
#python
2019-04-01
#python
2019-03-31
#python
2019-03-30
#python#sqlalchemy
2019-03-29
#工具
2019-03-27
#python
2019-03-27
#python
2019-03-26
#python
2019-03-25
#android
2019-03-17
#python#redis
2019-03-16
#shell
2019-03-15
#vim
2019-03-12
#python
2019-03-11
#android
2019-03-04
#go
2019-03-01
#go
2019-02-28
#算法
2019-02-27
#linux
2019-02-26
#vim
2019-02-24
#mysql#sqlalchemy
2019-02-21
#vim
2019-02-20
#算法
2019-02-19
#go
2019-02-18
#python
2019-02-17
#go
2019-02-07
#linux#ssr
2019-02-05
#vagrant
2019-02-04
#vim
2019-02-03
#go
2019-02-02
#python#mysql
2019-02-01
#linux
2019-01-26
#mysql
2019-01-23
#docker
2019-01-22
#python
2019-01-19
#hexo
2019-01-18
#react
2019-01-15
#go
2019-01-14
#linux
2019-01-11
#java
2019-01-10
#java
2019-01-09
#java
2019-01-08
#java
2019-01-07
#杂谈
2019-01-06
#linux
2019-01-03
#java
2019-01-01
#杂谈
2018-12-31
#杂谈
2018-12-30
#java
2018-12-29
#java
2018-12-28
#python
2018-12-27
#java
2018-12-26
#java
2018-12-25
#java
2018-12-24
#java
2018-12-20
#python
2018-12-18
#linux
2018-12-17
#杂谈
2018-12-13
#redis
2018-12-12
#hexo
2018-12-11
#mac
2018-12-10
#python
2018-12-06
#宝贝
2018-11-28
#node
2018-11-27
#linux
2018-11-20
#go
2018-11-19
#go
2018-11-15
#工具
2018-11-13
#杂谈#漫威
2018-11-09
#go
2018-11-07
#go
2018-11-02
#go
2018-10-29
#go
2018-10-28
#shell
2018-10-27
#expect
2018-10-26
#git
2018-10-25
#linux
2018-10-24
#go
2018-10-23
#linux
2018-10-22
#linux
2018-10-21
#http
2018-10-20
#python
2018-10-19
#mac
2018-10-18
#算法#leetcode
2018-10-17
#linux
2018-10-16
#算法#leetcode
2018-10-15
#算法#leetcode
2018-10-14
#算法#leetcode
2018-10-13
#算法#leetcode
2018-10-12
#go
2018-10-11
#mysql#linux
2018-10-10
#python
2018-10-09
#mysql
2018-10-08
#zsh
2018-10-07
#算法
2018-10-06
#算法
2018-10-05
#python
2018-10-04
#python
2018-10-03
#python
2018-10-02
#python
2018-10-01
#python
2018-09-30
#git
2018-09-29
#python
2018-09-28
#mysql
2018-09-27
#python
2018-09-26
#mysql
2018-09-25
#linux
2018-09-24
#redis
2018-09-23
#go
2018-09-22
#go
2018-09-21
#go
2018-09-20
#mysql
2018-09-19
#linux
2018-09-18
#mac
2018-09-17
#vim#go
2018-09-16
#工具
2018-09-15
#mysql
2018-09-14
#go
2018-09-13
#linux#awk
2018-09-12
#linux
2018-09-11
#linux
2018-09-10
#工具#go
2018-09-09
#go
2018-09-08
#go
2018-09-07
#go
2018-09-06
#mac
2018-09-05
#http
2018-09-04
#算法
2018-09-03
#go
2018-09-02
#linux#go
2018-09-01
#linux
2018-08-31
#算法
2018-08-30
#go
2018-08-29
#python
2018-08-28
#go
2018-08-27
#go
2018-08-26
#go
2018-08-25
#python
2018-08-24
#go
2018-08-23
#go
2018-08-22
#go
2018-08-21
#go
2018-08-20
#go
2018-08-19
#go
2018-08-18
#javascript
2018-08-17
#python
2018-08-16
#go
2018-08-15
#go
2018-08-14
#go
2018-08-13
#go
2018-08-12
#go
2018-08-11
#go
2018-08-10
#go
2018-08-09
#java
2018-08-08
#markdown
2018-08-07
#jquery
2018-08-06
#javascript#html
2018-08-05
#javascript#jquery
2018-08-04
#jquery
2018-08-03
#flask
2018-08-02
#linux
2018-08-01
#python
2018-07-31
#flask
2018-07-30
#微信
2018-07-29
#python
2018-07-28
#工具
2018-07-27
#python
2018-07-26
#python
2018-07-25
#python
2018-07-24
#vagrant
2018-07-23
#工具
2018-07-22
#openresty
2018-07-21
#python
2018-07-20
#python
2018-07-19
#mysql
2018-07-18
#vim
2018-07-17
#jquery
2018-07-16
#linux
2018-07-15
#python
2018-07-14
#微信
2018-07-13
#python
2018-07-12
#flask
2018-07-11
#vagrant
2018-07-10
#linux
2018-07-09
#shell
2018-07-08
#css
2018-07-07
#python
2018-07-06
#linux
2018-07-05
#elastic
2018-07-04
#elastic
2018-07-03
#linux
2018-07-02
#mysql
2018-07-01
#ansible
2018-06-30
#linux
2018-06-29
#shell
2018-06-28
#linux
2018-06-27
#linux
2018-06-26
#node
2018-06-25
#宝贝
2018-06-24
#linux
2018-06-23
#linux
2018-06-22
#javascript
2018-06-21
#python
2018-06-20
#shell
2018-06-19
#java#linux
2018-06-18
#expect
2018-06-17
#宝贝
2018-06-16
#mysql
2018-06-15
#java#linux
2018-06-14
#docker
2018-06-13
#宝贝
2018-06-12
#elastic
2018-06-11
#python
2018-06-10
#mysql
2018-06-09
#宝贝
2018-06-08
#java
2018-06-07
#linux
2018-06-06
#宝贝
2018-06-04
#mysql#linux
2018-06-04
#shell
2018-06-03
#linux
2018-06-02
#linux
2018-06-01
#shell
2018-05-31
#expect
2018-05-30
#nginx
2018-05-29
#shell
2018-05-28
#mac
2018-05-27
#shell
2018-05-26
#shell
2018-05-25
#docker
2018-05-24
#nginx
2018-05-23
#linux
2018-05-22
#linux
2018-05-21
#vagrant
2018-05-20
#docker
2018-05-19
#linux
2018-05-18
#docker
2018-05-17
#docker
2018-05-16
#docker
2018-05-15
#docker
2018-05-14
#python
2018-05-13
#node
2018-05-12
#node
2018-05-11
#hexo
2018-05-10
#electron
2018-05-09
#javascript
2018-05-08
#javascript
2018-05-07
#linux#mac
2018-05-06
#javascript
2018-05-05
#javascript#html
2018-05-04
#javascript
2018-05-03
#javascript
2018-05-02
#工具
2018-05-01
#html
2018-04-30
#javascript
2018-04-29
#javascript#html
2018-04-28
#javascript#html
2018-04-27
#javascript
2018-04-26
#javascript
2018-04-25
#开发
2018-04-24
#python
2018-04-23
#python
2018-04-22
#python
2018-04-21
#linux
2018-04-20
#javascript
2018-04-19
#杂谈
2018-04-18
#python
2018-04-17
#git
2018-04-16
#工具
2018-04-15
#javascript
2018-04-14
#javascript
2018-04-13
#javascript#工具
2018-04-12
#mac
2018-04-11
#python
2018-04-10
#linux
2018-04-09
#nginx
2018-04-08
#北京
2018-04-07
#杂谈#vim
2018-04-06
#linux
2018-04-05
#nginx
2018-04-04
#mysql
2018-04-03
#linux
2018-04-02
#nginx
2018-04-01
#nginx
2018-03-31
#linux#nginx
2018-03-30
#nginx
2018-03-29
#javascript
2018-03-28
#javascript
2018-03-27
#python#sqlalchemy
2018-03-26
#mysql
2018-03-25
2018-03-24
#python
2018-03-23
#python
2018-03-22
#javascript
2018-03-21
#python
2018-03-20
#python
2018-03-19
#python
2018-03-18
#python
2018-03-17
#python
2018-03-16
#python
2018-03-15
#mysql
2018-03-14
#开发
2018-03-13
#杂谈
2018-03-12
#linux
2018-03-11
#python
2018-03-10
#python
2018-03-09
#工具#mac
2018-03-08
#python
2018-03-07
#mac
2018-03-06
#python
2018-03-05
#杂文
2018-03-04
#javascript
2018-03-03
#vim
2018-03-02
#python
2018-03-01
#python
2018-02-28
#工具
2018-02-27
#python
2018-02-26
#iterm#expect
2018-02-25
#python
2018-02-24
#python#工具
2018-02-23
#python#graphql
2018-02-22
#python
2018-02-21
#杂文
2018-02-20
#javascript
2018-02-19
#python#flask
2018-02-18
#javascript
2018-02-17
#linux
2018-02-16
#javascript
2018-02-15
#杂谈
2018-02-14
#python#graphql
2018-02-13
#javascript
2018-02-12
#工具
2018-02-11
#北京#生活
2018-02-10
#react
2018-02-09
#shell
2018-02-08
#react
2018-02-07
#react
2018-02-06
#node
2018-02-05
#node
2018-02-04
#react
2018-02-03
#mac
2018-02-02
#python
2018-02-01
#python#微信
2018-01-31
#javascript
2018-01-30
#javascript
2018-01-29
#javascript
2018-01-28
#工具
2018-01-27
#工具
2018-01-26
#python
2018-01-25
#python#flask
2018-01-24
#python
2018-01-23
#python
2018-01-22
#python
2018-01-21
#maven#springboot
2018-01-20
#maven#springboot
2018-01-19
#python
2018-01-18
#杂谈
2018-01-17
#北京#生活
2018-01-16
#python
2018-01-15
#linux
2018-01-14
#javascript
2018-01-13
#python
2018-01-12
#hexo
2018-01-11
#python#jinja2
2018-01-10
#java#maven#spring
2018-01-09
#git
2018-01-08
#java#maven#spring
2018-01-07
#杂谈
2018-01-06
#工具
2018-01-05
#javascript#工具
2018-01-04
#javascript#工具
2018-01-03
#python
2018-01-02
#vim
2018-01-01
#杂谈
2017-12-31
#杂谈
2017-12-30
#vim
2017-12-29
#linux
2017-12-28
#node
2017-12-27
#python
2017-12-26
#杂文
2017-12-25
#工具
2017-12-24
#mysql
2017-12-23
#工具
2017-12-22
#工具
2017-12-21
#linux
2017-12-20
#node
2017-12-19
#算法
2017-12-18
#python
2017-12-17
#javascript
2017-12-16
#node
2017-12-15
#node
2017-12-14
#javascript
2017-12-13
#python#mysql
2017-12-12
#hexo
2017-12-11
#python#算法
2017-12-10
#python
2017-12-09
#javascript#工具#算法
2017-12-09
#python#linux
2017-12-08
#python#javascript#java#算法
2017-12-07
#java
2017-12-06
#python#javascript#工具#java#算法
2017-12-05
#python#javascript#算法
2017-12-05
#python
2017-12-02
#vim
2017-12-01
#vim
2017-11-30
#开发
2017-11-29
#vim
2017-11-27
#杂谈
2017-11-24
#python
2017-11-24
#linux#mac
2017-11-23
#linux
2017-11-23
#linux
2017-11-22
#linux
2017-11-22
#杂谈
2017-11-21
#python#mac
2017-10-31
2017-10-13
2017-10-13
#vim
2017-10-13
#vim
2017-10-13
#vim
2017-10-13
#vim
2017-10-04
#tmux
2017-09-25
#vim
2017-09-25
#vim
2017-09-25
#vim
2017-09-25
#vim
2017-09-25
#vim
2017-09-25
#vim
2017-09-25
#vim
2017-09-25
#vim
2017-09-24
#linux#mac#ssh
2017-09-24
#linux#mac#tmux
2017-09-23
#vim
2017-09-23
#vim
2017-09-23
#vim
2017-09-22
#python#javascript#vim
2017-09-22
#javascript#vim
2017-09-21
#http#linux
2017-09-20
#vim
2017-09-19
#git
2017-09-19
2017-09-19
#mysql
2017-09-18
#hexo
2017-09-17
#hexo
2017-09-14
#linux#expect
2017-09-14
#mysql
2017-09-11
#nodejs
2017-09-10
#linux
2017-09-10
#linux
2017-09-07
#开发
2017-09-06
#mac#HomeBrew
2017-09-06
#python
2017-09-06
#python#markdown
2017-09-05
#北京#生活
2017-09-05
#北京#生活
2017-09-04
#python#微信
2017-09-01
#linux
2017-08-28
#vim
2017-08-27
#linux
2017-08-22
#linux#ssh
2017-08-22
#mac
2017-08-22
#python
2017-08-22
#vim
2017-08-21
#linux
2017-08-21
#linux
2017-08-21
#python
2017-08-18
#python
2017-08-17
#python
2017-08-17
#python
2017-08-15
#http
2017-08-15
#http#linux
2017-08-15
#openresty
2017-08-15
#linux#mac
2017-08-14
#linux
2017-08-14
#python#flask
2017-08-14
#python
2017-08-14
#python#flask
2017-08-14
#python
2017-08-13
#ansible
2017-08-13
#python
2017-08-12
#movie
2017-08-11
#mysql
2017-08-10
#mysql
2017-08-10
#python
2017-08-09
#mac
2017-08-09
#mysql
2017-08-09
#python
2017-08-09
#python
2017-08-08
#mysql
2017-08-08
#mysql
2017-08-08
#mysql
2017-08-08
#mysql
2017-08-08
#mysql
2017-08-07
#ansible
2017-08-07
#ansible
2017-08-07
#ansible
2017-08-07
#mysql
2017-08-06
#mysql
2017-08-05
#mysql
2017-08-05
#mysql
2017-08-04
#算法
2017-08-04
#算法
2017-08-04
#javascript
2017-08-03
#git
2016-03-24
#杂谈