Create root privilege user on MySQL server.

MySQL root privileges user is “root”, I always remove “root” userid once I got MySQL installed, mainly for security purpose, secondly I do not want stupid thing happened like someone able to brute force into MySQL database.

You can create “root” alike privilege user in MySQL by following the step below:

shell> mysql -u root -p mysql 
mysql> GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' \
       IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'username'@'127.0.0.1' \
       IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql> flush privileges;
mysql> quit;

OR

shell> mysql -u root -p mysql 
mysql> CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;
mysql> CREATE USER 'username'@'%' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;
mysql> flush privileges;
mysql> quit;

You can add a few more privileges user if you have more than 1 person to admin MySQL Database.

Scroll to top