MySQL - Explain how to add a new user account in MySQL

Explain how to add a new user account in MySQL.

- New users in MySQL can be added using the CREATE USER syntax.

You can create MySQL accounts in two ways:

1. By using account-management statements intended for creating accounts and establishing their privileges, such as CREATE USER and GRANT. These statements cause the server to make appropriate modifications to the underlying grant tables.

2. By manipulating the MySQL grant tables directly with statements such as INSERT, UPDATE, or DELETE.

- The CREATE USER statement creates new MySQL accounts. It enables account authentication properties to be established.

- To use CREATE USER, you must have the global CREATE USER privilege or the INSERT privilege for the mysql database.

- When the read_only system variable is enabled, CREATE USER additionally requires the SUPER privilege.

- An error occurs if you try to create an account that already exists.

CREATE USER userName IDENTIFIED BY 'passwordString';

- The password is created in an encrypted format.
MySQL - How to change the password for user account in MySQL
How to change the password for user account in MySQL - Password in MySQL can be changed using SET PASSWORD command.......
MySQL - What are user privileges in MySQL?
What are user privileges in MySQL? - Privileges in MySQL are used to restrict users accessing data objects and functions. Below are the commonly used......
MySQL - What are the scope levels a user privilege can be granted?
What are the scope levels a user privilege can be granted? - Global Level – This privilege applies to ALL databases present. Privileges granted at the global level stored in mysql.user table......
Post your comment