Mysql must know meeting Reading Notes-security management and database maintenance,
Security Management
You can view all user information in the user table of the mysql database.
Create a user account
CREATE USER ben IDENTIFIED BY 'p@$$wOrd'
Rename a user account
RENAME USER ben TO bens;
Delete a user account
DROP USER ben;
Before mysql5, you must first REVOKE the account-related permissions and then DROP the USER;
User Permissions
View
SHOW GRANTS FOR ben;
GRANT SELECT ON crashcourse.* TO ben;
Allows ben to use select on the crashcourse Database
REVOCK SELECT ON crashcourse.* FROM ben;
Revoke the select permission of ben on the crashcourse database.
The access permission must exist when it is revoked; otherwise, an error occurs.
GRANT and REVOKE can control access permissions at several levels:
The whole server uses grant all and revoke all;
For the entire database, use ON database .*;
For specific tables, use ON database. table;
Specific columns;
Specific stored procedures.
Permission table:
Change Password
SET PASSWORD FOR ben = Password('password');
Do not specify user set password to change current user PASSWORD
Database Maintenance backup
Mysqldump dumps all database content to external files
Mysqlhotcopy copies all data from a database
Mysql backup table or SELECT INTO OUTFILE
Data can be restored using RESTORE TABLE
Fulsh tables is required before backup;