MySQL 错误 #1046 - XAMPP 上没有选择数据库 SQL 导入

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11438427/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 14:08:37  来源:igfitidea点击:

Error #1046 - No database selected SQL import on XAMPP

mysqlsqldrupalphpmyadminxampp

提问by accraze

I am trying to import the SQL database from my Drupal production site into a sandbox testing site on my local machine. I currently use XAMPP on my machine here at work.

我正在尝试将 SQL 数据库从我的 Drupal 生产站点导入到我本地机器上的沙盒测试站点。我目前在我的机器上使用 XAMPP 工作。

I have downloaded my db aipiadxxm_if9DHdr.sqland then I go to the phpMyAdmin on http://localhost/phpmyadmin/index.phpthen to -> Import.

我已经下载了我的数据库aipiadxxm_if9DHdr.sql,然后我转到 phpMyAdmin,http://localhost/phpmyadmin/index.php然后转到 -> 导入。

After I import the db I get this Error:

导入数据库后,出现此错误:

SQL query:
--
-- Database: `aipiadxxm_if9DHdr.sql`
--
-- --------------------------------------------------------
--
-- Table structure for table `if9d_access`
--
CREATE TABLE IF NOT EXISTS `if9d_access` (
`aid` int( 11 ) NOT NULL AUTO_INCREMENT ,
`mask` varchar( 255 ) NOT NULL default '',
`type` varchar( 255 ) NOT NULL default '',
`status` tinyint( 4 ) NOT NULL default '0',
PRIMARY KEY ( `aid` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;


MySQL said: Documentation
#1046 - No database selected 

What is causing this error message: #1046 - No database selected?

是什么导致此错误消息:#1046 - No database selected

回答by scronide

You need to create and/or select the database on your sandbox machine before importing the SQL for the table structure and data.

在为表结构和数据导入 SQL 之前,您需要在沙箱机器上创建和/或选择数据库。

In phpMyAdmin, this means choosing a database from the sidebar and thenusing its import tab. If the database you want to fill doesn't exist, you have to create it first using the Create new databaseform.

在 phpMyAdmin 中,这意味着从侧边栏中选择一个数据库,然后使用其导入选项卡。如果要填充的数据库不存在,则必须先使用Create new database表单创建它。

After import, you should confirm that the export-import process hasn't affected the anonymous user record(uid 0).

导入后,您应该确认导出导入过程没有影响匿名用户记录(uid 0)。