first of all, to declare: In general, to modify the MySQL password, authorization, is required to have the root authority in MySQL. Note: This operation is also available at the win command prompt, phpMyAdmin. User: Phplamp user database: Phplampdb1. Create a new user. //log in to MySQL@>mysql-u root-p@> Password//Create usermysql> INSERT INTO Mysql.user (Host,user,password) VALUES ("localhost", "Phplamp", Password ("1234"));//Refresh System Permissions TableMysql>flush privileges;This creates a user named: Phplamp with a password of: 1234. then log in. mysql>exit;@>mysql-u phplamp-p@> Enter Passwordmysql> Login Successful2. Authorize the user. //log in to MySQL (with root access). I am logged in as root.@>mysql-u root-p@> Password//First create a database for the user (phplampdb)mysql>create database phplampdb;//Authorize Phplamp user to have all rights to the Phplamp database. >grant all privileges in phplampdb.* to [e-mail protected] identified by ' 1234 ';//Refresh System Permissions TableMysql>flush privileges;mysql> Other Operations/*If you want to specify partial permissions to a user, you can write:mysql>grant select,update on phplampdb.* to [e-mail protected] identified by ' 1234 ';//Refresh the System permissions table. Mysql>flush privileges;*/3. Delete the user. @>mysql-u root-p@> Passwordmysql>delete from user WHERE user= "phplamp" and host= "localhost";Mysql>flush privileges;//Delete a user's databasemysql>drop database phplampdb; 4. Modify the specified user password. @>mysql-u root-p@> Passwordmysql>update Mysql.user Set Password=password (' New password ') where user= "Phplamp" and host= "localhost";Mysql>flush privileges;
MySQL Add user and password