MySQL database export and import and common error resolution

Source: Internet
Author: User
Tags table name import database mysql backup mysql command line mysql database backup
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  

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.