Skip to content Skip to sidebar Skip to footer

How to Create Database User for MySQL

Below commands used for create MySQL user with password.

User Creation
CREATE USER 'theuser'@'localhost' IDENTIFIED BY 'your_password';
CREATE USER 'theuser'@'%' IDENTIFIED BY 'your_password';

Grant Access to the New User
GRANT ALL ON *.* TO 'theuser'@'localhost';
GRANT ALL ON *.* TO 'theuser'@'%';

If you need the user to be able to logged in from remote computer, you may also need to change the bind-address settings in the /etc/mysql/my.cnf or /etc/mysql/mysql.conf.d/mysqld.cnf to the correct one depend on your environment (not localhost or

To confirm it, you can check on which IP and port the services listening to by issuing netstat -tulpn command.

Post a Comment for "How to Create Database User for MySQL"