Mysqlcmd commonly used commands. If you need to execute mysql through a command line occasionally, refer.
Mysql cmd commonly used commands. If you need to execute mysql through command lines occasionally, refer.
Put mysql.exe in the binary directory under mysqldirectory under C: \ WINDOWS. You can run the following command:
Connection: mysql-h host address-u user name-p User Password (Note: u and root do not need to add spaces, the same is true for others)
Disconnected: exit (Press ENTER)
Create authorization: grant select on database. * to username @ login host identified by \ "password \"
Change password: mysqladmin-u username-p old password New password
Delete authorization: revoke select, insert, update, delete om *. * from test2 @ localhost;
Display Database: show databases;
Show table: show tables;
Display table structure: describe table name;
Database creation: create database name;
Delete database: drop database name;
Database used: use Database Name;
Create table: create table Name (field setting list );
Delete table: drop table name;
Alter table t1 rename t2
Query table: select * from table name;
Clear table: delete from table name;
Backup table: mysqlbinmysqldump-h (ip)-uroot-p (password) databasename tablename> tablename. SQL
Restore table: mysqlbinmysql-h (ip)-uroot-p (password) databasename tablename <tablename. SQL (delete the original table before the operation)
ADD column: alter table t2 ADD c int unsigned not null AUTO_INCREMENT, add index (c );
ALTER 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
Recover database: mysql \ bin \ mysql-h (ip)-uroot-p (password) databasename <database. SQL
Copy Database: mysql \ bin \ mysqldump -- all-databases> all-databases. SQL
Fix the 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