Method 1: Use the SET PASSWORD command mysql -u root mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass'); Method 2: Using mysqladmin mysqladmin -u root password "newpass" If the root password has been set, use the following method mysqladmin -u root password oldpass "newpass" Method 3: Use UPDATE to edit the user table directly mysql -u root mysql> use mysql; mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root'; mysql> FLUSH PRIVILEGES; Create a normal user User Management mysql>use mysql; Check mysql> select host,user,password from user; create mysql> User Management mysql>use mysql; Check mysql> select host,user,password from user; Create User mysql> insert into mysql.user (Host,User,Password) Values('%','wise',PASSWORD('passwd')); msyql> FLUSH RPIVILEGES Revise mysql>rename user feng to newuser; //Can be used after mysql 5, before that, you need to use update to update the user table delete mysql>drop user newuser; //Before mysql5, you must first use revoke to delete the user's permissions and then delete the user. After mysql5, the drop command can delete the user and the user's related permissions at the same time. change password mysql> set password for zx_root =password('xxxxxx'); mysql> update mysql.user set password=password('xxxx') where user='otheruser' View User Permissions mysql> show grants for zx_root; Grant permissions mysql> grant all privileges on YQ.* to wise; Reclaim Permission mysql> revoke select on dmc_db.* from zx_root; //If the permission does not exist, an error will be reported Revise mysql>rename user feng to newuser; //Can be used after mysql 5, before that, you need to use update to update the user table delete mysql>dropuser newuser; //Before mysql5, you must first use revoke to delete the user's permissions and then delete the user. After mysql5, the drop command can delete the user and the user's related permissions at the same time. change password mysql> set password for zx_root =password('xxxxxx'); mysql> update mysql.user set password=password('xxxx') where user='otheruser' View User Permissions mysql> show grants for zx_root; Grant permissions mysql> grant select on dmc_db.* to zx_root; Reclaim Permission mysql> revoke select on dmc_db.* from zx_root; //If the permission does not exist, an error will be reported The above is the editor's introduction to MySQL's creation of root users and ordinary users and modification and deletion functions. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Common methods of Vue componentization: component value transfer and communication
>>: How to Customize Bash Command Prompt in Linux
The order in which objects call methods: If the m...
Table of contents In vue2 In vue3 Notes on setup ...
1. Background Netplan is a new command-line netwo...
mysql permissions and indexes The highest user of...
This article shares the specific code for the js ...
Alignment issues like type="radio" and t...
Today I used docker to pull the image, but the sp...
Before starting the main text, I will introduce s...
What are :is and :where? :is() and :where() are p...
Preface When writing front-end pages, we often us...
Table of contents 1. What is Docker Compose and h...
Find the installation directory of VirtualBox. Th...
This article analyzes the consistency processing ...
Preface: Basically, whether it is for our own use...
The main contents of this article are as follows:...