Mysql record and mysql record
1. Create a USER command:
<! ----> Mysql> create user yy identified by '20160301 ';
Yy indicates the username you want to create, and 123 indicates the password.
The user created above can log in anywhere.
If you want to restrict Logon at a fixed address, such as localhost Logon:
<! ----> Mysql> create user yy @ localhost identified by '20140901 ';
2. grant permissions:
<! ----> Mysql> grant all privileges on *. * TO user; @ localhost <! ----> Grant select, insert, update, delete on *. * to test1 @ "%" Identified by "abc ";
Grant select, insert, update, delete on *. * to test1 @ "%" Identified by "abc ";
Format: grant select on database. * to username @ login host identified by "password"
Change Password:
<! ----> Mysql> grant all privileges on pureftpd. * to koko @ localhost identified by 'mimimi ';
Flush:
<! ----> Mysql> flush privileges;
View user information:
<! ----> Mysql> select host, user from mysql. user; 3. delete a user.
@> Mysql-u root-p
@> Password
Mysql> delete from user WHERE User = "phplamp" and Host = "localhost ";
Mysql> flush privileges;
// Delete the user's database
Mysql> drop database phplampDB;
4. Modify the password of the specified user.
@> Mysql-u root-p
@> Password
Mysql> update mysql. user set password = password ('new password') where User = "phplamp" and Host = "localhost ";
Mysql> flush privileges;
5. list all databases
Mysql> show database;
6. Switch the database
Mysql> use 'database name ';
7. list all tables
Mysql> show tables;
8. display the data table structure
Mysql> describe table name;
9. Delete databases and data tables
Mysql> drop database name;
Mysql> drop table data table name;