Common mysql commands and common mysql system commands
Recently, some mysql commands were often used during my internship, so I made some preparations:
Solve the character garbled problem: display Chinese characters rather than garbled characters: set names utf8;
Change New password: update user set PASSWORD = password ('new password') where user = 'username ';
Update permission: flush privileges;
Add a new user: grant select on database. * to username @ login host identified by 'Password ';
Delete A user: delect from user where user = 'username' and host = 'localhost ';
Delete database: drop database dbname;
Drop table tablename;
View the currently used database: select () database;
Get the table structure: desc tablename;
Show columns from tablename;
Decribe tablename;
Insert data: insert into tablename values (),();
Query the data of the first few rows: select * from tablename order by id limit;
Change table name: rename table original table name to new table name;
Data Import: source * SQL (direct path );
Data export: mysqldump-u root-p Database Name> exported file name (the file name can be directly stored in the local directory)