Summary of common MySQL command line operations

Source: Internet
Author: User

This article from csdn ucser, http://blog.csdn.net/perfectpdl reprinted to indicate the source, thank you!

1. Import an SQL file to the database:

To use the source command, you must first log on to the MySQL Console

Mysql-u-p

Use xxxdatabase;

Source/test. SQL

2. Export the database table structure to the SQL File

Mysqldump-u root-p-D dbname> dbname. SQL

If you only want to export a database table, add the table name after the database name. Separate multiple tables with spaces.

3. Modify the MySQL password

Mysqladmin-u username-P old Password New Password

4. Connect to the MySQL database

Mysql-H host address-u user name-P User Password

5. Create a database, create a table,

Create Database database name;

  
Create Table Name

6. Delete databases and tables 

Drop database database name; drop table name

7.Clear records in the table

Delete from table name;

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.