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...