Skip to content

Instantly share code, notes, and snippets.

@mrtdeh
Forked from Hikingyo/admin.sql
Last active April 14, 2024 06:58
Show Gist options
  • Save mrtdeh/e2b974e6bcd1a888b6ed190467ec8459 to your computer and use it in GitHub Desktop.
Save mrtdeh/e2b974e6bcd1a888b6ed190467ec8459 to your computer and use it in GitHub Desktop.
create admin user with all privileges on mysql/mariadb
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
## remote connection - not secure
CREATE USER 'admin'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment