First of all, we need to declare 1:1. Generally, the modification of MySQL password and authorization requires the permission of root in mysql. Note: this operation is at the WIN command prompt, and phpMyAdmin also applies. User: phplamp user database: phplampDB
1. Create new users
/ / login MYSQL @ > mysql -u root -p @ > password // create users 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 with password: 1234. Then log in 1. mysql > exit; @ > mysql -u phplamp -p @ > Enter the password mysql > Login successful
2. User authorization
If you want to allow user myuser to connect to mysql server from ip’s 192.168.1.6 host and use mypassword as password
GRANTALL PRIVILEGES ON *.* TO ‘myuser’@‘192.168.1.3’ IDENTIFIED BY ‘mypassword’ WITHGRANT OPTION;
FLUSH PRIVILEGES;
3. Delete users
@ > 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. Modify 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;