How do I create a user with the same privileges as root in MySQL/MariaDB?

srinivasankanna picture srinivasankanna · May 25, 2013 · Viewed 224.5k times · Source

How do I create a user with the same privileges as root in MySQL/MariaDB?.

Answer

imulsion picture imulsion · May 25, 2013
% mysql --user=root mysql
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' WITH GRANT OPTION;
CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%' WITH GRANT OPTION;
CREATE USER 'admin'@'localhost';
GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
CREATE USER 'dummy'@'localhost';
FLUSH PRIVILEGES;