3.MYSQL Create new user

Source: Internet
Author: User

After logging in to the MySQL server, you can use the grant command to create a user and assign permissions.

mysql>for-adatabase changedmysql> GRANT select,insert,update,delete , Create,drop    -on MySQL    -to [email protected]0 rows affected, 1 warning (0.11 sec )

The above command creates a user information record in the MySQL database. a semicolon (;) indicates that the instruction has been edited and ready to execute.

You can then see whether the new user exists by using the following command.

Mysql> Select User, host,authentication_string from User;+------------------+-----------+-------------------------------------------+| User             |Host|Authentication_string|+------------------+-----------+-------------------------------------------+|Root|localhost| *74ed8dce9b1b4b780e427473ddd66f8be6398e8e||Mysql.sys|localhost| *Thisisnotavalidpasswordthatcanbeusedhere||Debian-Sys-Maint|localhost| *0e2901479c3b89118b95a2622b7f895dfc60c4a0||Zara|localhost| *08f7d6c84224646b57bdf66a6480f337f403f10c||Firstuser|localhost| *2470c0c06dee42fd1618bb99005adca2ec9d1e19||Rick|localhost| *35eb40c575cd0daa851919e0e3e28c0718879407|+------------------+-----------+-------------------------------------------+6Rowsinch Set(0.00Sec

As you can see, a new user is already present and you are logged in as a user.

Note: The password entry for the user table in MySQL5.7 has been replaced with authentication_string

Mysql>\qbyedeamon@deamon-h55m-S2:~$ mysql-U firstuser-penter password:welcome toThe MySQL Monitor. CommandsEnd  with;or\g.your MySQL Connection ID is TenServer Version:5.7. --0ubuntu0.16.04.1(Ubuntu) Copyright (c) -, ., Oracleand/orits affiliates. Allrights reserved. Oracle isA registered trademark ofOracle Corporationand/oritsaffiliates. Names may trademarks oftheir respectiveowners. Type'Help ;' or '\h'  forHelp. Type'\c'  toClear the Currentinput Statement.mysql> 

3.MYSQL Create new user

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.