Common commands for MySQL under Linux

Source: Internet
Author: User

after MySQL is built under Linux, some common database commands are:

Creating a library: Create DATABASE MyDatabase;
Show all Databases list: show databases;
Delete database: Drop Dabatase mydatabase;
Make MyDatabase the current default database: Use MyDatabase;
Creating table: Create TABLE custmoers (userid int not null,username varchar (a) not null);
Delete tables: drop table cutomers;
Show table: Show tables;
Display table structure: DESC customers;
Insert a record into the Customers table: INSERT into Customers (Userid,username) VALUES (1, ' Hujiahui ');
Let the operation take effect immediately: commit;
Querying records in Customers: SELECT * FROM Customers;
Update the data in the table: Update customers set Username= ' licongying ' where userid=1;
Delete a record from a table: delete from customers;
Grant HJH user access to the database: Grant Select,insert,update,delete on *. * to Hjh@localhost identified by "123456", where Hjh is the user name
123456 is the password.
Login mysql:mysql-uhjh-p123456

Sina Weibo @ Leather likes playing basketball














Common commands for MySQL under Linux

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.