mysql - 从mysql备份文件导入数据时出错

标签 mysql node.js npm

Using mysqldump npm module.While import the backfile generated using this npm.Get this error.

var mysqlDump = require('mysqldump');

mysqlDump({
    host: 'localhost',
    user: 'root',
    password: '',
    database: 'test',
    tables:[], // only these tables
    dest:'./data.sql' // destination file
},function(err){
    // create data.sql file;
})

Error :

"11:28:40 Restoring C:\Users\xxxx\Documents\dumps\xx24052018.sql Running: mysql.exe --defaults-file="c:\users\xxx\appdata\local\temp\tmptdzvot.cnf" --protocol=tcp --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments < "C:\Users\xxxx\Documents\dumps\xxxx24052018.sql" ERROR 1046 (3D000) at line 1: No database selected

Operation failed with exitcode 1
11:28:41 Import of C:\Users\xxxx\Documents\dumps\xxxx24052018.sql has finished with 1 errors"

最佳答案

错误提示

No database selected

您确定所有数据库设置吗?

关于mysql - 从mysql备份文件导入数据时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50502238/

相关文章:

mysql - 将新的 Rails 应用程序连接到现有的 MySQL 数据库

java - hibernate删除多对多关联

node.js - 使用 REST api 注册用户时出现错误

npm - 在 cypress js 上运行测试之前提供 SPA

mysql 获取列但不包含空列

c++ - 为什么简单的 mysql++ 代码可以独立编译,但不能在项目中编译?

javascript - 使用 NodeJS/Express 应用程序保护 AJAX 调用

javascript - express.js 样板代码的用途是什么?

javascript - NPM 注册表 API,通过 JSON 响应查看包的内部结构和文件

javascript - 如何在 package.json 中添加目录以在 npm 中发布