Create a character set database and how to authorize data manipulation permissions on users

Source: Internet
Author: User

Operating system: CentOS6.0

Database system: Mysql

Task: Create a character Set database and issue user authorization

First, set up the character set database to avoid garbled characters.

1) Establish a name of SKY9896_GBK the character set database

Mysql>create DATABASE sky9896_gbk DEFAULT CHARACTER SET GBK;

2) Establish a name of Sky9896_utf the character set database

mysql> CREATE DATABASE sky9896_utf8 DEFAULT CHARACTER SET UTF8;

3 ) Displays the built -in sky9896 Database Information

Mysql> Show CREATE Database sky9896\g; 1. Row ***************************

database:sky9896

Create database:create Database ' sky9896 '/*!40100 DEFAULT CHARACTER SET GBK */

1 row in Set (0.00 sec)

ERROR:

No query specified

4) mysql> drop user ' @ ' localhost.localdomain '; # Delete the extra user account

Query OK, 0 rows Affected (0.00 sec)

5) Mysql> grant all privileges in SKY9896_GBK to [email protected]; # How to authorize

6 ) mysql> Show grants for [email protected]\g # Show Authorized Information

1. Row ***************************

Grants for [e-mail protected]: GRANT USAGE on *. * to ' sky9896 ' @ ' localhost ' identified by PASSWORD ' *23ae809ddacaf96af0fd78e d04b6a265e05aa257 '

2. Row ***************************

Grants for [e-mail protected]: GRANT all privileges on ' sky9896_gbk '. ' SKY9896_GBK ' to ' sky9896 ' @ ' localhost '

2 rows in Set (0.00 sec)

7) mysql> revoke insert on SKY9896_GBK from ' sky9896 ' @ ' localhost '; # retract insert permissions

Query OK, 0 rows Affected (0.00 sec)

Second, Production environment authorization:

1 recommendations for authorized users of production environments:

mysql> CREATE DATABASE blog DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci; # Create a blog GBK character Set database

Query OK, 1 row Affected (0.00 sec)

Mysql> Grant Select,insert,update,delete,create on blog.* to ' sky9896 ' @ ' localhost ' identified by ' 123 ';

Query OK, 0 rows Affected (0.00 sec)

2 Authorization for the user of the production environment Master library:

Mysql> Grant Select,insert,update,delete on * * to ' blogs ' @ ' localhost ' identified by ' 1231 ';

3) authorization of the production environment from the library user

Mysql> Grant SELECT On * * to ' blogs ' @ ' localhost ' identified by ' 123 ';

This article is from the "Linux~dba~mba" blog, make sure to keep this source http://sky9896.blog.51cto.com/2330653/1603697

Create a character set database and how to authorize data manipulation permissions on users

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.