Mysql command to import sql data backup method

Source: Internet
Author: User
Keywords Network programming Mysql tutorial
Tags backup command line create data data backup export file ftp
The following is the command line import sql data, you need friends can refer to the next. My personal practice is: phpmyadmin export utf-8 insert mode abc.sql
ftp abc.sql to the server
ssh to the server
mysql-u abc-p use KKK (database name, if not create database KKK) set names 'utf8' source abc.sql
Note: I see set character set utf8; argument, that does not work, Chinese garbled.
First open the command line console mysql
Perhaps the order is as follows:
mysql-u root-p database_name
You may then be prompted to enter the corresponding password
The following command may be useful to you when you want to change a database
mysql> use database_name
Then use the following command
mysql> source d: datafilename.sql
Of course, you need to figure out where the file path, and correctly use the mysql directory where he entered into the subdirectory of bin. Enter the implementation of the import command sql.
For example: your mysql installed in d: mysql
Proceed as follows:
Start -> Run -> Enter CMD
D:
cd mysqlbin
mysql-u root-p123456 test <d: a.sql
Where root is your mysql administrator user name, 123456 for the password test for the database name d: a.sql backup data file location.
If it is Windows, from the command prompt to the MYSQL file directory Bin folder, execute the command
mysql-u root-p databasename <db.sql
Where root is your MYSQL user name, databasename is the name of your database, and db.sql you are the file. Note that you must put db.sql into the bin folder can be. Of course, the location of the file can be changed.
If it is LINUX, direct input
mysql databasename <db.sql
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.