MySQL cmd Common command mysql cmd Common command has the following command: Put the Mysql.exe in the bin directory under the MySQL directory under C:\WINDOWS, you can execute the following command
Connection: Mysql-h host address-u user name-P user Password (note: U and root can be used without spaces, others are the same)
Disconnect: Exit (Enter)
Create authorization: Grant SELECT on database. * To User name @ login host identified by \ "Password \"
Change Password: mysqladmin-u user name----old password password new password
Delete authorization: Revoke select,insert,update,delete OM * * from [email protected];
Display database: show databases;
Display Data sheet: show tables;
Display table structure: describe table name;
Create Library: Name of creation database;
Delete Library: drop database name;
Usage Library: Use library name;
Creating Tables: Create table table names (field settings list);
Delete tables: drop table name;
Modify table: ALTER TABLE t1 rename T2
Query table: SELECT * from table name;
Empty table: Delete from table name;
Backup table: Mysqlbinmysqldump-h (IP)-uroot-p (password) databasename tablename > Tablename.sql
Recovery table: Mysqlbinmysql-h (IP)-uroot-p (password) databasename tablename < Tablename.sql (first delete the original table before operation)
Add column: ALTER TABLE T2 ADD C INT UNSIGNED not NULL auto_increment,add INDEX (c);
Modify column: ALTER TABLE T2 MODIFY A TINYINT not NULL, change b C CHAR (20);
Delete column: ALTER TABLE T2 DROP column C;
Backup database: Mysql\bin\mysqldump-h (IP)-uroot-p (password) databasename > Database.sql
Recovery database: Mysql\bin\mysql-h (IP)-uroot-p (password) DatabaseName < Database.sql
Copy database: Mysql\bin\mysqldump--all-databases > All-databases.sql
Repair Database: Mysqlcheck-a-o-uroot-p54safer
Text data import: Load data local infile \ "file name \" into table name;
Data import and Export: Mysql\bin\mysqlimport database Tables.txt
MySQL cmd common commands