Home » Mysql » MySQL: creating a user with root privileges [closed]

MySQL: creating a user with root privileges [closed]

Posted by: admin November 1, 2017 Leave a comment

Questions:

I want to create a user with all the privileges that a root user has, the user should be able to access all databases, create databases and should be able to grant privileges to other users.

Answers:
shell> mysql --user=root mysql
mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
    ->     WITH GRANT OPTION;
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
    ->     WITH GRANT OPTION;
mysql> CREATE USER 'admin'@'localhost';
mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
mysql> CREATE USER 'dummy'@'localhost';
mysql> FLUSH PRIVILEGES;