In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to create new MySQL users, authorize and delete users and change passwords. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
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) values ("localhost", "phplamp", password ("1234"))
/ / 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 phplamp@localhost 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 phplamp@localhost 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= "phplamp" and Host= "localhost"
Mysql > flush privileges
/ / Delete the user's database
Mysql > 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
This is the end of how to create new users, authorize and delete users and change passwords in MySQL. I hope the above can be helpful and learn more. If you think the article is good, you can 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.