Note: The password field of the MySQL5.7 Mysql.user is to be used authentication_string
- -P
Create User: MySQL > Insert into MySQL. User (Host,User
authorizing a user
Authorization format:GrantPermissions onDatabase.* toUser name@ Login HostIdentified by"Password";
Authorize the test user to have all permissions for the TestDB database (all permissions for a database): MySQL>Grant All Privileges onTestDB.* toTest@localhostIdentified by '123'; Format:GrantPermissions onDatabase.* toUser name@ Login HostIdentified by"Password"; If you want to specify partial permissions to a user, you can write this: MySQL>Grant Select,Update onTestDB.* toTest@localhostIdentified by '123'; Authorization test user has some permissions for all databases: MySQL>Grant Select,Delete,Update,Create,Drop on *.* to[Email protected] "%"Identified by"123"; MySQL>FlushPrivileges;//Refresh System Permissions Table
Note:@ "%" indicates authorization for all non-local hosts, excluding localhost.
Delete user MySQL>Delete from User Where User='Test' andHost='localhost'; MySQL>FlushPrivileges; MySQL>Drop DatabaseTestDB;//Delete User's database Delete account and permissions:>Drop UserUser name @'%'; >Drop UserUser name @ localhost;
Modify the specified user password mysql>update MySQL. User set Password=password (' new password 'whereUser= and Host="localhost"; MySQL>privileges;
list all databases MySQL > database;
switch Database MySQL > Use ' Database name ';
list all tables MySQL >Show Tables;
Show data table structure MySQL >describe table name;
deleting databases and data tables MySQL > Drop Database database name; MySQL>droptable data table name;
query version number MySQL >
MySQL Common commands