MySQL知识点滴

  1. 用源码安装MySQL后,将其加入后台服务管理:cp support-files/mysql.server /etc/init.d/mysql.server
  2. 垂直显示查询结果集:(1)Shell命令行下,使用mysql命令并带上-E选项。例如:mysql -E -uuser1 -ppwd1 db1 < query1.sql;(2)MySQL命令行下,使用select查询语句并带上\G选项。例如:select * from student \G;
  3. 查看存储引擎信息:(1)show engines; (2)浏览 information_schema 数据库的 ENGINES 表;
  4. 将查询结果导出到csv:
    select * from (
    select father, group_concat(id order by id asc separator ';') son from associate a where rate>0  group by father 
    union 
    select id father, '-' son from business b where id not in (select distinct father from associate where rate>0) and id not in (select id from associate where rate>0)
    ) fs into outfile '/var/lib/mysql-files/father_son.csv' fields terminated by ',' lines terminated by '\r\n';

    其中,若报"--secure-file-priv"错误,需执行"show variables like '%secure%';"查看安全路径位置
    fields terminated by ','设置字段分隔符
    optionally enclosed by '#'设置字段内容若为字符串,则使用#号包含
    lines terminated by '\r\n'设置行分隔符

转载于:https://www.cnblogs.com/alwu007/p/5424508.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值