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