MySQL basic commands

Source: Internet
Author: User


MySQL basic command: 1, net stop MySQL//shut down MySQL client

2. net start MySQL//turn on MySQL

3, Mysql-u root-p123 (password)//login MySQL Client

4, show databases;//View Database

5. Use test;//switch to test database

6, show tables;//View all tables

7. Select *from User;//view table data

8. DESC User//View table field

9, drop database user;//delete databases

10, Exit//Exit Client

11. Rename table user to User1//modify the tables name

12. drop TABLE user;//Delete tables

13. Show create DATABASE test;//view DB Character Set

14. Show CREATE table user;//view the tables character set

15. Insert into User (Id,name,pass) VALUES (1, "xiaoming", 123);//Add Data

16. Select *from user;//View data

· 17. Delete from user where id=1;//deletes data under a condition

18. Update user Set name = "Floret" where id=1;//change content

19. ALTER TABLE user add age int;//add field

20. ALTER TABLE user modify age int NOT null default 20;//modify field

21. ALTER TABLE user drop age;//Delete field

22. ALTER TABLE user change name username varchar (30);//Modify field name


MySQL basic commands

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.