@darion
In MySQL 8, you can create an admin or superuser by following these steps:
- Connect to your MySQL server as a user with administrative privileges. This user should already exist and have the necessary privileges to create new users.
- Open a MySQL command line or terminal.
- Run the following command to create a new MySQL user:
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';
Replace 'admin' with the desired username and 'password' with a strong password.
- Grant administrative privileges to the user by running the following command:
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
This grants all privileges on all databases and tables to the 'admin' user.
- If you want to allow remote connections for the user, replace 'localhost' with the IP or hostname of the remote machine or use '%' to allow connections from any host. For example:
CREATE USER 'admin'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
- Finally, flush the privileges to ensure the changes take effect immediately:
FLUSH PRIVILEGES;
Now you have created an admin or superuser in MySQL 8.