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
Table of contents Routing Manager background gett...
Translucent border Result: Implementation code: &...
Table of contents need Get data and submit Templa...
To be honest, this question involves a lot of cor...
Vue $http get and post request cross-domain probl...
Preface Everyone should be familiar with the watc...
I am very happy to attend this episode of potato ...
1. Open port 2375 Edit docker.service vim /lib/sy...
Docker takes up a lot of space. Whenever we run c...
Table of contents Seconds_Behind_Master Original ...
First, the server environment information: Reason...
Preface: I have always wanted to know how a SQL s...
We have many servers that are often interfered wi...
In CSS, element tags are divided into two categor...
This article example shares the specific code of ...