简体   繁体   中英

Import Full MySQL Dump

I have exported a full backup of a database with HeidiSQL 7.

Now when importing it via PHPMyAdmin, I noticed that I MUST select the database information_schema , because that's how the DB is exported (Or this is how HeidiSQL 7 exports databases as objects to an SQL file?).

However, that is a problem because when I import (the exported file) with HeidiSQL 7 (instead of PHPMyAdmin), while selecting the information_schema database, and clicking on Import SQL file (from the tools menu), it says that access is denied for the root user.

In PHPMyAdmin, the option to import is not available when selecting the database information_schema .

How do I import my full database dump? (This is how I exported it: HeidiSQL > export database objects to SQL file)

Edit: I tried it with the command line, but without luck:

C:\Programs\XAMPP\mysql\bin>mysql --verbose --user=root Information_schema < DT.
sql
--------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */
--------------

--------------
/*!40101 SET NAMES utf8 */
--------------

--------------
/*!40014 SET FOREIGN_KEY_CHECKS=0 */
--------------

--------------
/*!40000 ALTER TABLE `CHARACTER_SETS` DISABLE KEYS */
--------------

ERROR 1044 (42000) at line 13: Access denied for user 'root'@'localhost' to data
base 'information_schema'

C:\Programs\XAMPP\mysql\bin>

This is a snippet of the SQL file: http://pastebin.com/6hwhK2CJ

Note: The password for my root user is blank.

Maybe another solution for my problem: How do I import only the database I want, from the SQL file? For example a database with the name "Employees"? Because that SQL file should contain a few databases.

Edit2: (answer to first comment) I downloaded MySQL Workbench, setup the connection...

03:23:08 Restoring C:\Files\DB.sql

Running: mysql.exe --defaults-extra-file="c:\files\temp\tmplnjwd6.cnf"  --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments < "C:\\Files\\DB.sql"

ERROR 1046 (3D000) at line 13: No database selected


Operation failed with exitcode 1

03:23:08 Import of C:\Files\DB.sql has finished with 1 errors

INFORMATION_SCHEMA is a pseudo, read-only database (in fact, it is an " ANSI standard set of read-only views ").

You need to remove all dump data related to this pseudo database, as there is absolutely no way to import it.

Notepad++ is able to easily handle a 9 MB file, and also provides nice syntax highlighting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM