MySql Common commands

Source: Internet
Author: User
Tags mysql commands

MySql Common commands
Mysql Common commands
I haven't been writing a blog for a long time. It's time to write a summary of what I 've learned recently.
Today, we will summarize some common mysql commands:
Login: mysql-uroot-p-P3306-h ---- (-u indicates the user name,-p indicates the password, you can leave it blank,-P indicates the port number,-h indicates the host name)
Display the current server VERSION: select version ();
Display current date and time: SELECTNOW ();
Show current USER: select user ();
Create a database: ([] can be written or not)
CREATE {DATABASE | SCHEMA} [if not exists] db_name [DEFAULT] character set [=] charset_name
View the list of data tables on the current server:
SHOW {DATABASES | SCHEMAS} [LIKE 'patter '| WHERE expr]
Modify database:
ALTER {DATABASE | SCHEMA} [db_name] [DEFAULT] character set [=] charset_name
Delete database:
DROP {DATABASE | SCHEMA} [if exists] db_name

Certificate -------------------------------------------------------------------------------------------------------------------------------------------
Create a data table:
Create table [if not exists] table_name (
Column_name data_type,
......
);
Display data table:
Show tables [FROM db_name] [LIKE 'patter '| WHERE expr]
Display data table structure:
Show columns from tbl_name



Updating...

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.