Last active
          January 16, 2023 15:25 
        
      - 
      
- 
        Save karson/2aa7abf9bbf0d920de76b3b71c354fd9 to your computer and use it in GitHub Desktop. 
Revisions
- 
        karson revised this gist Jan 16, 2023 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,13 @@ #for new user CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass'; CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass'; GRANT ALL ON *.* TO 'myuser'@'localhost'; GRANT ALL ON *.* TO 'myuser'@'%'; FLUSH PRIVILEGES; #For existing users #This grants root access with the same password from any machine in *.example.com: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%.example.com' 
- 
        karson created this gist Jan 16, 2023 .There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ #This grants root access with the same password from any machine in *.example.com: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%.example.com' IDENTIFIED BY 'some_characters' WITH GRANT OPTION; FLUSH PRIVILEGES; #If name resolution is not going to work, you may also grant access by IP or subnet: GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.%' IDENTIFIED BY 'some_characters' WITH GRANT OPTION; FLUSH PRIVILEGES;