Mysql 5.6 adds a method to modify username and password

Mysql 5.6 adds a method to modify username and password

Log in to MySQL first

shell> mysql --user=root mysql

If you have a password, you need to add the --password or -p option

Adding Users

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 database specific 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';

To delete a user:

mysql>DROP USER 'jeffrey'@'localhost';

To change your password:

mysql>SET PASSWORD FOR 'jeffrey'@'localhost' = PASSWORD('mypass');

Modify the password of the currently logged in user:

mysql>SET PASSWORD = PASSWORD('mypass');

The above is the method of adding and modifying usernames and passwords in MySQL 5.6 introduced by the editor. 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:
  • 2 ways to connect to the database directly without entering a username and password

<<:  Summary of the unknown usage of "!" in Linux

>>:  React Hooks Usage Examples

Recommend

How to completely delete the MySQL service (clean the registry)

Preface When installing the executable file of a ...

Brief analysis of the MySQL character set causing database recovery errors

Importing data with incorrect MySQL character set...

33 ice and snow fonts recommended for download (personal and commercial)

01 Winter Flakes (Individual only) 02 Snowtop Cap...

Introduction to Computed Properties in Vue

Table of contents 1. What is a calculated propert...

A brief introduction to VUE uni-app core knowledge

Table of contents specification a. The page file ...

Docker Compose installation and usage steps

Table of contents 1. What is Docker Compose? 2. D...

Vue application example code based on axios request encapsulation

Table of contents What is axios? Axios request ty...

mysql 5.7.5 m15 winx64.zip installation tutorial

How to install and configure mysql-5.7.5-m15-winx...

VMware Tools installation and configuration tutorial for Ubuntu

Some time ago, the blogger installed the Ubuntu s...

Reasons for the sudden drop in MySQL performance

Sometimes you may encounter a situation where a S...

Detailed explanation of DOM style setting in four react components

1. Inline styles To add inline styles to the virt...

Manually implement js SMS verification code input box

Preface This article records a common SMS verific...

Creative About Us Web Page Design

Unique “About”-Pages A great way to distinguish yo...