Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to the method of adding New users to MySQL Database

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

In this article, we mainly introduce the method of adding new users to the MySQL database, so how to add new users to the MySQL database, the editor has not yet operated in the command mode, and now it is all operated through phpmyadmin, let's take a look at the tutorial organized by the editor, hoping to help you.

After installing MySQL on VPS, the default user is root@localhost. The easiest way to add a new MySQL user is:

Execute the following statement in phpmyadmin (add points at the end of the statement; sign):

Grant all privileges on DBNAME.* to USERNAME@localhost identified by 'PASSWORD' flush privileges

Of course it runs in SSH.

Mysql-uroot-p

You can also enter the above sql statement after that, with the same effect.

The explanation is as follows:

This will add a new user, the user name is USERNAME, the password is PASSWORD, and this user has permission to modify, read and so on in the DBNAME database.

Add an article on how to add users more clearly.

1 New user

Mysql-u root-p

Enter password

Then enter the mysql command line management

Insert into mysql.user (Host,User,Password) values ('localhost','admin',password (' 123456'))

/ / refresh the system permissions table

Mysql > flush privileges

2 create a database

Create database newdatabase

3 authorize the user

Mysql > grant all privileges on newdatabase.* to admin@localhost identified by '123456; mysql > flush privileges

You can also grant specific permissions to the user

Grant select, insert,update,delete on newdatabase.* to admin@localhost identified by '123456'

A total of 14 permissions select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file

Mysql > grant all privileges on vtdc.* to joe@10.163.225.87 identified by '123'

Assign user joe from 10.163.225.87 permissions to perform all operations on all tables in the database vtdc, and set the password to 123.

Mysql > grant all privileges on *. * to joe@10.163.225.87 identified by '123'

The user joe from 10.163.225.87 is assigned permissions to perform all operations on all tables in all databases, and the password is set to 123.

Mysql > grant all privileges on *. * to joe@localhost identified by '123'

Assign the local user joe permission to perform all operations on all tables in all databases and set the password to 123.

This is the end of the introduction on how to add new users to the MySQL database, of course, not only the above and everyone's analysis, but the editor can ensure its accuracy is absolutely no problem. I hope that the above content can have a certain reference value for everyone, and can be put into practice. If you like this article, you might as well share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report