Mysql must know meeting Reading Notes-security management and database maintenance,

Source: Internet
Author: User
Tags mysql backup

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;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.