SQL error(1046):No database selected.

记录一个问题:

关于MySQL数据库导入SQL文件时,导入失败,报错以下内容:

SQL error(1046):No database selected.

如图:
SQL错误

经过检查后发现,是我脑子有疤,压根没有新建数据库,直接在整个MySQL 环境下运行SQL文件(能成功就有鬼了)。

正确流程:
1)先创建一个新的数据库,命令行同样操作;
在这里插入图片描述

# 命令行操作
create database 数据库名;

2)选中数据库,命令行中即使用该数据库:
在这里插入图片描述

use 数据库名;

3)导入SQL文件运行

在这里插入图片描述

source sql文件路径

然后就成功了。

所以,自己下次一定记得建数据库啊!

  • 6
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
Migrate your database effortlesly. Copy all your table data, indexes, foreign keys - and more. When you need the power: migration of huge tables (> 500 GB) unmatched customization features scheduler for recurring migrations target database explorer powerful command-line interface custom datatype mapping custom default values mapping on-the-fly data transformation ...and much much more. Feature list: While this is not a complete feature list, it will certainly give you a look into the quality and robustness of Full Convert. It auto-adapts to your data and database engines used and selects the best possible data transfer algorithm for your conversion scenario. You have full control over the database migration and can override most of the things you can think of. Supports 17 database engines for conversion source Supports 14 database engines for conversion target Supports databases and individual tables of unlimited size Auto-adapts to user configuration for maximum speed Auto-adapts to target database rules when naming objects Uses bulk insert modes of target databases wherever possible Built-in Scheduler for recurring conversions Easy to use modern interface Database explorer Table data viewer and editor Command-line support with rich project override switches Automatic character set translation Full Unicode support for international character data Incredible conversion speed Only dedicated native database components used for maximum speed, control, and reliability Auto-select of optimal algorithm to transfer data reliably based on table structure, database engine and database version Speeds of over 30 thousand records per second reached in favorable configurations Speeds of 5 to 15 thousand records per second are common when databases and Full Convert are on the same machine Data Viewing and Editing In-place editing Editing can be enabled and disabled to avoid accidental modification Full Unicode support for international character data Easy export to Microsoft Excel Load and Save cell value Best fit columns and Auto-height rows In-place image and BLOB viewing Selected rows deletion Jump to specific record Built-in table Print Preview and Print Table Customization Table customization available for each table separately Renaming of both table and each column Skipping of certain columns in conversion Creation of new columns with specification of SQL data expressions Free-style data type and default value modification per column Source table filtering (SQL where condition specification) Project Customization Conversion step modification (create table, indexes, constraints) Data creation override (copy data, append, no data) Auto-rename objects (table name prefix, table and column casing) Run SQL scripts before and after conversion, on both source and target database SQL scripts can be written in Full Convert editor, or dynamically loaded from external file, even if it is compressed - and file type mask can be specified to ignore certain files Global Options SQL logging and conversion error logging Specification of source and target table chunk size read into RAM Automatic character-set translation. Manual override available. Global object renaming rules (prefix, casing) Global user mappings for all data types and all target databases. Specific type lengths rules supported. Global defaults mapping for all target databases Specific options for each database engine Requirements Runs great on all Windows versions, including Windows 8.1 and Windows Server Runs on both 32- and 64-bit Windows (x86 and x64) Can be installed on Linux and Mac under virtualization software Easily connects to databases running on Unix/Linux/Mac

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值