N3xtchen 的数字花园

Search

Search IconIcon to open search

MySQL 的小技巧

上次更新于 Feb 20, 2023 编辑源文件

# 文件导出

1
2
<select 语句> 
INTO OUTFILE '/Users/nextchen/z.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n'

# 检查是否支持导出权限

报错信息如下: The MySQL server is running with the –secure-file-priv option so it cannot execute this statement

# 检查下系统配置
1
SHOW VARIABLES LIKE "secure_file_priv"; 
Variable_nameValue
secure_file_priNULL

如果 Values 不为 NULL.my.conf 尾部加入如下文本

1
2
3
[mysqld_safe]
[mysqld]
secure_file_priv=""

# 杀进程

1
2
3
4
SHOW FULL PROCESSLIST;
-- 找出你执行已经卡住很久的sql
-- id:进程ID,
KILL ID