MySQL Simple operation

Source: Internet
Author: User
Tags mysql version

MySQL version: 5.7.13

1. Run the command prompt as an administrator and go to the installation location of MySQL
2. Start MySQL service: net start MySQL
3.root Identity Login: Mysql-uroot-p Enter


4. List all databases: show databases;
5. Creation of a database: Create databases database_name;
6. Determine if there is a re-creation database: Create databases if not EXISTS database_name;
7. Delete databases: DROP database database_name;
8. Select a database: Use database_name;


9. List all data tables in the selected database: Show tables;
10. Columns of the Display data table (column) Details: Show columns fromtable_name; or: Describetable_name;
11. Check the Display data sheet: SELECT * FROMtable_name;
12. Conditional Presentation Data sheet: SELECT * FROM table_name whereID>=2;
13. Creating a data table: CREATE TABLEtable_name(Col_01_nameType Details, col_02_name Type Details,...);
14. First determine the data table: CREATE table if not existstable_name(...);
15. Copy Data sheet: CREATE tabletable_name_01SELECT * FROMtable_name_02;
16. Renaming the data table: ALTER TABLEtable_nameRename asnew_table_name; Or: Rename tableOld_nameTonew_name;
17. Delete Data sheet: drop tabletable_name;


18. Add a record to the data table: INSERT INTO table_name set col_01 = value1 , col_02 = value2 ;
19. Modify the records in the datasheet: Update table_name set col_name = new_value where ID = 1;
20. Delete the records in the data table: Delete from table_name ;
21. Record in a conditionally deleted data table: Delete from table_name where id =1;


#当前时间查看: Select Now ();
#当前用户: Select User ();
#当前数据库程序版本: Select version ();
#当前状态: Show status;
#查看当前连接的用户: Show Processlist;

MySQL Simple operation

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.