How to create MySQL admin user (superuser) account

To create a new MySQL admin (superuser) account, you can use the following steps:

  1. Log in to the MySQL shell as the root user:
mysql -u root -p
  1. Create a new user with the desired username and password, and grant them all privileges:
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
  1. Flush the privileges to make the changes take effect:
FLUSH PRIVILEGES;
  1. Exit the MySQL shell:
EXIT;

You can now log in to the MySQL shell using the new admin account by running the following command:

mysql -u username -p

Note: Make sure to replace ‘username’ and ‘password’ with the actual values you want to use.

Leave a Comment