How to add and modify the user name and password in Mysql 5.6, mysql5.6
Log on to MySQL first
shell> mysql --user=root mysql
If you have a password, you need to add the-password or-p option.
Add User
mysql>CREATE USER 'finley'@'localhost' IDENTIFIED BY 'some_pass';mysql>GRANT ALL PRIVILEGES ON *.* TO 'finley'@'localhost' WITH GRANT OPTION;mysql>CREATE USER 'finley'@'%' IDENTIFIED BY 'some_pass';mysql>GRANT ALL PRIVILEGES ON *.* TO 'finley'@'%' WITH GRANT OPTION;mysql>CREATE USER 'admin'@'localhost' IDENTIFIED BY 'admin_pass';mysql>GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';mysql>CREATE USER 'dummy'@'localhost';
Add users and set specific database permissions:
mysql>CREATE USER 'custom'@'localhost' IDENTIFIED BY 'obscure';mysql>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON bankaccount.* TO 'custom'@'localhost';mysql>CREATE USER'custom'@'host47.example.com' IDENTIFIED BY 'obscure';mysql>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON expenses.* TO 'custom'@'host47.example.com';mysql>CREATE USER 'custom'@'%.example.com' IDENTIFIED BY 'obscure';mysql>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON customer.* TO 'custom'@'%.example.com';
Delete A User:
mysql>DROP USER 'jeffrey'@'localhost';
Change Password:
mysql>SET PASSWORD FOR 'jeffrey'@'localhost' = PASSWORD('mypass');
Modify the current logon user password:
mysql>SET PASSWORD = PASSWORD('mypass');
The above section describes how to add and modify a user name and password in Mysql 5.6. I hope it will be helpful to you. If you have any questions, please leave a message for me, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!