The simplest MySQL Command

Source: Internet
Author: User

In fact, I always think that databases are more difficult to understand than Ningbo's sister paper, but both of them have to face it ~
The story will continue, and the post will be updated occasionally ~
 
 
Connect to MySQL on the remote host: mysql-h110.110.110.110-uroot-pabcd123
Exit MySQL command: Exit/quit
Display the Database List: Show databases;
Database: Use Database Name;
Show tables;
Display the data table structure: DESC/describe table name;
Create Database: create databases database name;
Table creation: Create Table table name;
Clear a table: delete from table name; or truncate table name; Delete is a bit like deleting all records in the MySQL table one by one, while truncate is equivalent to retaining the structure of the MySQL table, after this table is re-created, all statuses are equivalent to new tables.
Database deletion and table deletion: drop database database name; drop table name;
Export Database: mysqldump-uroot-p123 database_test> database_test. SQL
Export table: mysqldump-uroot-pt123 database_test table_test> table_test. SQL
Export the select result to the file: mysql-h127.0.0.1-uroot-p0000-e "select * From table_name" database_name> 1.txt
Displays the records in the Table: Select * from table name;
Row count: Select count (*) from table name;
Show warnings;
Show errors;
Insert: insert into teacher values ('', 'glengang ', 'xx company', '2017-10-10 ');
Update: Update adregex_sample_0424 set is_wrong = 'true' where adnetwork_domain = 'travel .yahoo.com ';

Use utf8 Character Set: Set names utf8

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.