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.

Advertisement

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 %

Add a comment

Leave a Reply

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

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement