“Mysqldump”的版本间的差异

来自姬鸿昌的知识库
跳到导航 跳到搜索
(建立内容为“mysqldump 命令可以备份数据库中的数据。 备份时是在备份文件中保存了 create 语句和 insert 语句。<syntaxhighlight lang="shell"> mysq…”的新页面)
 
第21行: 第21行:
  
 
"--fields-optionally-enclosed-by=""设置字符括上 char、varchar 和 text 等字符型字段
 
"--fields-optionally-enclosed-by=""设置字符括上 char、varchar 和 text 等字符型字段
 +
 +
 +
出现<syntaxhighlight lang="text">
 +
mysqldump: [Warning] Using a password on the command line interface can be insecure.
 +
mysqldump: Got error: 1290: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement when executing 'SELECT INTO OUTFILE'
 +
</syntaxhighlight>的原因是安装MySQL的时候限制了导入与导出的目录权限,只允许在规定的目录下才能导出、导入。
 +
 +
可以查看

2024年7月10日 (三) 03:05的版本

mysqldump 命令可以备份数据库中的数据。

备份时是在备份文件中保存了 create 语句和 insert 语句。

mysqldump -u root -pPassword -T 目标目录 dbname table [option];

Password 参数表示 root 用户的密码,密码紧挨着 -p 选项;

目标目录 参数是指导出的文本文件的路径;

dbname 参数表示数据库的名称;

table 参数表示表的名称;

option 表示附件选项。


示例

C:\Users\Administrator>mysqldump -u root -p123456 -T E:\record\2024\7\10\ testdb student "--fields-terminated-by=," "--fields-optionally-enclosed-by=""
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Got error: 1290: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement when executing 'SELECT INTO OUTFILE'

"--fields-terminated-by=," 设置 , 为字段的分隔符,默认值是"\t";

"--fields-optionally-enclosed-by=""设置字符括上 char、varchar 和 text 等字符型字段


出现

mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Got error: 1290: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement when executing 'SELECT INTO OUTFILE'

的原因是安装MySQL的时候限制了导入与导出的目录权限,只允许在规定的目录下才能导出、导入。

可以查看