Last active
February 12, 2019 19:30
-
-
Save envygeeks/789971fd9b25375ab504ee27066b75c3 to your computer and use it in GitHub Desktop.
Force own MySQL Root
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET @@SESSION.SQL_LOG_BIN=0; | |
DELETE FROM mysql.user WHERE Host = ''; | |
DELETE FROM mysql.user WHERE User = 'root'; | |
DELETE FROM mysql.user WHERE User = '$MYSQL_USER'; | |
CREATE OR REPLACE USER 'root'@'%' IDENTIFIED BY '$MYSQL_ROOT_PASS'; | |
GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION; | |
DROP DATABASE IF EXISTS test; | |
CREATE DATABASE IF NOT EXISTS $MYSQL_DB; | |
CREATE OR REPLACE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASS'; | |
GRANT ALL ON $MYSQL_DB.* TO '$MYSQL_USER'@'%'; | |
FLUSH PRIVILEGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment