MySQL Add user settings

Source: Internet
Author: User

MySQL Add user settings

If you need to add a MySQL user, you only need to add new users to the user table in the MySQL database.

To add an instance of the user, the user name is guest, the password is guest123, and the user is authorized to perform Select,insert and update operation permissions

SHOW DATABASES;

Use MySQL;

SHOW TABLES;

SELECT * from USER;

INSERT into USER (host,user,password,select_priv,insert_priv,update_priv) VALUES (' localhost ', ' guest ', PASSWORD (' Guest123 '), ' y ', ' y ', ' y ');

SELECT * from USER;

FLUSH privileges;

When adding a user, be aware that the password is encrypted using the password () function provided by MySQL.

Note the flush privileges statement needs to be executed. This command will reload the authorization table when it is executed. If you do not use this command, you will not be able to use the newly created user to connect to the MySQL server unless you restart the MySQL server.

You can specify permissions for the user when you create the user, and in the corresponding permission column, set the ' '

Select_priv insert_priv update_priv delete_priv create_priv drop_priv reload_priv Shutdown_priv Process_priv File _priv grant_priv references_priv index_priv alter_priv show_db_priv super_priv create_tmp_table_priv Lock_tables_p Riv execute_priv repl_slave_priv repl_client_priv create_view_priv show_view_priv create_routine_priv Alter_routine _priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv

Another way to add users is through the SQL Grant command, the following command given the database demo add user Zara, the password is zara123.

GRANT Select,insert,update,delete,create,drop on demo.* to ' Zara ' @ ' localhost ' identified by ' zara123 ';


MySQL Add user settings

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.