MySQL command line import. SQL data to Database

Source: Internet
Author: User

1. First open the MySQL tutorial in the command line console
Perhaps the order is as follows:
Mysql-u root-p database_name
Then you may be prompted to enter the corresponding password
2. The following command may be useful to you when you want to change a database tutorial
Mysql>use database_name
Then use the following command
Mysql>source D:datafilename.sql
Of course you need to figure out the path to the file and use it correctly.
Enter the subdirectory bin of the directory where the MySQL installation resides. Enter the command to execute the import SQL.
For example: Your MySQL is installed in D:mysql
The steps are as follows:
Start-> run-> input cmd
D:
CD Mysqlbin
Mysql-u root-p123456 Test <d:a.sql
Where root is your MySQL administrator username, 123456 for password test d:a.sql the database name to the location of the backed-up data file.
If it is windows, execute the command from the command prompt to the bin folder in the MySQL file directory
Mysql-u root-p DatabaseName < Db.sql
Where root is your MySQL username, DatabaseName is the name of your database, and db.sql you are the file. Note that you must put Db.sql in the Bin folder before you can. The location of the file can be changed.
If it's Linux, enter it directly.
MySQL DatabaseName < Db.sql

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.