MySQL create user with root privileges

To create a user with “root” privileges, you need to find what privileges root has, this can be done with the command

SHOW GRANTS FOR 'root'@'localhost';

You can use the following commands to create a new user

GRANT ALL PRIVILEGES ON *.* TO 'USER_NAME'@'localhost' IDENTIFIED BY 'PASSWORD_HERE' WITH GRANT OPTION;
GRANT PROXY ON ''@'' TO 'USER_NAME'@'localhost' WITH GRANT OPTION;

Replace USER_NAME with your desired MySQL username. PASSWORD_HERE with the password you need.

localhost is to allow only connection from localhost, you can replace it with remote server hostname or IP. If you want to allow connection from any IP, use %

Back to MySQL Password

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *