Mysql command line code for importing SQL data _ MySQL

Source: Internet
Author: User
Mysql command line SQL data import code bitsCN.com my personal practice is: phpmyadmin export UTF-8 insert mode abc. SQL

Ftp abc. SQL to server

Ssh to server

Mysql-u abc-p
Use KKK (database name, if not, create database KKK)
Set names 'utf8'
Source abc. SQL
Note: I have seen the set character set utf8; Statement. it is not feasible. Chinese characters are garbled.

1. first open mysql in the command line console

Perhaps the command 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

Mysql> use database_name

Run the following command:

Mysql> source d:/datafilename. SQL

Of course, you need to clarify the path of the file and use it correctly.

Enter bin in the directory where mysql is installed. enter the command to import SQL.

For example, your mysql is installed in d:/mysql

The procedure is as follows:

Start> Run> enter CMD

D:

Cd mysql/bin

Mysql-u root-p123456 test
Here, root is your mysql administrator username, and 123456 is the password test is the database name d:/a. SQL is the location of the backup data file.

For Windows, go to the Bin folder in the MYSQL file directory from the command prompt and execute the command

Mysql-u root-p databasename <db. SQL

Here, root is your MYSQL User name, databasename is your database name, and db. SQL: You are a file. note that you must set db. the SQL statement can be placed in the bin folder. of course, the file location can be changed.

For LINUX, enter

Mysql databasename <db. SQL

The default mysql command is the system command.

BitsCN.com

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.