MySQL CREATE database and create user and authorize

Source: Internet
Author: User
Tags dba mysql create mysql create database

1. View user-related information through the MySQL Database users table

Mysql>Use mysqlreading table information forCompletion of table and column namesyou can turn off Thisfeature to get a quicker startup with-adatabase Changedmysql>select Host,user,password from user;+-----------+------+-------------------------------------------+| Host | user | Password |+-----------+------+-------------------------------------------+| localhost | Root | *87f2746835a04895bb77e12aa5054a767******* | | Qxyw |                                           Root | || 127.0.0.1 |                                           Root | ||      localhost |                                           | ||      Qxyw |                                           | |+-----------+------+-------------------------------------------+5 rowsinchSet (0.00 sec)


2. Create a database

Default1 Row Affected (0.00 sec)


3. Create a user

mysql> create user ' dba ' @ '% ' identified by ' ******* '0 rows Affected (0.00 sec)

Meaning of the value of the host column in the user table% match all hosts localhost localhost will not be resolved to an IP address, directly via Unixsocket connection 127.0.0.1 will be connected via TCP/IP protocol and can only be accessed natively;:: 1 :: 1 is compatible with support IPv6, indicating the same as IPv4 127.0.0.1


4. Access to the DBA user for additional pruning and checking of the specified database

Mysql> Grant Select,insert,update,delete, create on [databasename].*0 rows Affected (0.00 sec)


Note: Be sure to refresh the service after modifying the permissions, or restart the service, refresh the service by: Flush privileges

MySQL CREATE database and create user and authorize

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.