MySQL 将sql数据库导入phpmyadmin时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19846973/
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
Error when importing sql database to phpmyadmin
提问by user2961517
I'm having trouble when trying to import a database into phpmyadmin.
尝试将数据库导入 phpmyadmin 时遇到问题。
Error
SQL query:
--
-- Database: `iiumcms`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE IF NOT EXISTS `admin` (
`fname` VARCHAR( 50 ) NOT NULL ,
`email` VARCHAR( 50 ) NOT NULL ,
`admin_no` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`dept_id` VARCHAR( 15 ) NOT NULL ,
`username` VARCHAR( 30 ) NOT NULL ,
`password` VARCHAR( 30 ) NOT NULL ,
PRIMARY KEY ( `admin_no` )
) ENGINE = INNODB DEFAULT CHARSET = latin1 AUTO_INCREMENT =7;
MySQL said: Documentation
#1046 - No database selected
回答by TheOddAbhi
You have to create an empty database with name 'iiumcms' in your PhpMyAdmin and have to select this database in left sidebar before importing your .sql file.
您必须在 PhpMyAdmin 中创建一个名为“iiumcms”的空数据库,并且必须在导入 .sql 文件之前在左侧边栏中选择该数据库。
回答by Elon Than
You have to first select your database, then import file.
您必须首先选择您的数据库,然后导入文件。
In MySQL you can use this statement:
在 MySQL 中,您可以使用以下语句:
USE `iiumcms`;
If you don't have this database created, you have to do it first.
如果您没有创建此数据库,则必须先创建。
回答by Miguel Q.
This error when o didn't tells to mysql what is the database to do the restore. You need put:
当 o 没有告诉 mysql 进行还原的数据库是什么时出现此错误。你需要把:
USE `your_database_name`;
at the begin of your file.
在文件的开头。
回答by Sathish D
In phpMyAdmin, this means choosing a database from the sidebar and then using its import tab. If the database you want to fill doesn't exist, you have to create it first using the Create new database
form.
在 phpMyAdmin 中,这意味着从侧边栏中选择一个数据库,然后使用其导入选项卡。如果要填充的数据库不存在,则必须先使用Create new database
表单创建它。