MySQL database export and import process will occur many unpredictable errors, this article has sorted out some common errors and corresponding solutions, encounter similar situation friends can refer to, I hope to help you
mysql command line export database:
1, enter the Bin folder in the MySQL directory: cd MySQL to the Bin folder directory
As I entered the command line: CD C:Program Filesmysqlmysql Server 4.1bin
(or add the directory directly to the environment variable path of Windows)
2, Export database: Mysqldump-u user name-p database name > exported text The name
is the command line I entered: mysqldump-u root-p jluibmclub > D:jluibmclub. SQL (input will allow you to enter the password to MySQL)
(if you export a single sheet in the data After the library name enter the table name)
in the command to do the database backup process in the CMD command box to enter C:/mysql/bin>mysqldump-uroot-p jluibmclub> d:jluibmclub. sql;
Error message: Mysqldump:got error:1049:unknown database ' Jluibmclub ' when selecting the database, can not identify jluibmclub this a database.
But I am in:
mysql> show databases;
Display:
+---------------+
| Database |
+---------------+
| jpa |
+---------------+
Mysql>use JPA;
Display:
Database changed
The reason is simple, just remember one point. Do not enter the MySQL environment is not the execution of SQL statements, so you do not have to add a comma (";").
If you enter the MySQL environment mysql>, the statement entered is part of the SQL statement and must be preceded by a comma (";").
3, you will see the file News.sql automatically generated to D disk under the file, if you do not specify the letter default in the bin directory.
Command-line Import Database:
1, enter mysql:mysql-u Username-P
as I entered the command line: mysql-u root-p (Input same will let you enter my SQL password)
2, create the database you want to build in Mysql-front, this is an empty database, such as a new target database named News
3, enter: Mysql>use target database name
As I entered the command line: Mysql>use news;
4, import file: Mysql>source the file name imported;
As I entered the command line: Mysql>source news.sql (If you use a relative pathname in the bin directory, if you use an absolute directory name in a different directory);
MySQL backup and restore is done using the mysqldump, MySQL, and source commands.
1.win32 mysql backup and restore