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

How to authorize, delete, and change passwords for new MySQL users

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "MySQL new users how to authorize, delete users and change passwords", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "MySQL new users how to authorize, delete users and change passwords" bar!

Test environment: WIN32 mysql5.0.45

First of all, let's make it clear: in general, to change the MySQL password and authorization, you need to have the root permission in mysql.

Note: this operation is at the WIN command prompt, phpMyAdmin is also applicable.

User: phplamp user database: phplampDB

1. Create a new user.

/ / Log in to MYSQL

@ > mysql-u root-p

@ > password

/ / create a user

Mysql > insert into mysql.user (Host,User,Password,ssl_cipher,x509_issuer,x509_subject) values ("localhost", "pppadmin", password ("passwd"),')

/ / refresh the system permissions table

Mysql > flush privileges

This creates a user named: phplamp password: 1234.

And log in.

Mysql > exit

@ > mysql-u phplamp-p

@ > enter your password

Mysql > Login succeeded

two。 Authorize the user.

/ / Log in to MYSQL (with ROOT permission). I log in as ROOT.

@ > mysql-u root-p

@ > password

/ / first create a database (phplampDB) for the user

Mysql > create database phplampDB

/ / authorized phplamp users have all permissions in the phplamp database.

> grant all privileges on phplampDB.* to identified by '1234'

/ / refresh the system permissions table

Mysql > flush privileges

Mysql > other actions

/ *

If you want to assign partial permissions to a user, you can write like this:

Mysql > grant select,update on phplampDB.* to identified by '1234'

/ / refresh the system permission table.

Mysql > flush privileges

, /

3. Delete the user.

@ > mysql-u root-p

@ > password

Mysql > DELETE FROM user WHERE User= "lamp" and Host= "localhost"

Mysql > flush privileges

/ / delete the user's

> drop database phplampDB

4. Modifies the specified user password.

@ > mysql-u root-p

@ > password

Mysql > update mysql.user set password=password ('new password') where User= "phplamp" and Host= "localhost"

Mysql > flush privileges

Thank you for your reading, the above is the "MySQL new users how to authorize, delete users and change passwords" content, after the study of this article, I believe you on MySQL new users how to authorize, delete users and change the password of this problem has a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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