![]() Using the IF EXISTS statement in the query is considered a good practice as it prevents the creation of a user if it already exists in the database with the same username. We need to use the GRANT statement to assign privileges to users to access and manipulate the database and its contents. ![]() When a new user is created, it is not assigned any of the privileges. When we want to add space or dash(-) or any other character in the user name of the hostname, then we need to quote the username and hostname in either single quotes, double quotes, or backticks as shown password_to_be_used field helps us specify the password of the newly created user that will be used at the time of login to the MySQL database by that user. The hostname is optional, and when not specified, the account name is equivalent to %, which indicates that the user can access the database from any host. Hostname helps us specify from which host the user will access and connect to the MySQL database. When creating a new user in MySQL, the account name is specified by combining the username and hostname, separated by the symbol. The account name consists of two things the name of the user and the hostname. Name of the account is the account name you wish to give to the new user. Given below is the following syntax of CREATE USER statement to create a new user in MySQL: CREATE USER name_of_account Hadoop, Data Science, Statistics & others Syntax of MySQL add user
0 Comments
Leave a Reply. |