- 用源码安装MySQL后,将其加入后台服务管理:
cp support-files/mysql.server /etc/init.d/mysql.server
- 垂直显示查询结果集:(1)Shell命令行下,使用mysql命令并带上-E选项。例如:mysql -E -uuser1 -ppwd1 db1 < query1.sql;(2)MySQL命令行下,使用select查询语句并带上\G选项。例如:select * from student \G;
- 查看存储引擎信息:(1)show engines; (2)浏览 information_schema 数据库的 ENGINES 表;
- 将查询结果导出到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