How to create MySQL admin user (superuser) account

www.lautt‮iru‬.com
How to create MySQL admin user (superuser) account

To create a MySQL admin user (also known as a superuser) account, you can follow these steps:

  1. Connect to the MySQL server using the mysql command-line client. You will need to use a user account with administrative privileges to do this:
mysql -u root -p
  1. Create a new user account using the CREATE USER statement. Replace username with the desired username and password with the desired password:
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
  1. Grant the new user account administrative privileges using the GRANT statement. For example:
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost';

This will grant the new user all privileges on all databases and tables.

  1. Flush the privileges to apply the changes:
FLUSH PRIVILEGES;
  1. Exit the MySQL client:
exit

You can now use the new user account to connect to the MySQL server with administrative privileges.

Created Time:2017-10-28 21:39:01  Author:lautturi