Answers for "how to create a username and password for a mysql database"

SQL
75

mysql create user

CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';
FLUSH PRIVILEGES;
Posted by: Guest on May-19-2020
1

create mysql user

#in the case below, your username is dbuser
#and we assume that the mysql db is located in the same server or box from where you want to access it from
#after the IDENTIFIED BY and within the single qoute (') you you should replace 'complexPassword' with a password your desire
CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'complexPassword';

#we assume that the name of your database is db_name
#the command below grants the user you created with privilege to only database db_name
#if your want dbuser to have access to all database the replace db_name with *
GRANT ALL PRIVILEGES ON db_name . * TO 'dbuser'@'localhost';

#the command below reloads the privileges of mysql with your new user privileges
FLUSH PRIVILEGES;

#don't forget give a thumbs up
Posted by: Guest on September-23-2021

Code answers related to "how to create a username and password for a mysql database"

Code answers related to "SQL"

Browse Popular Code Answers by Language