Skip to content

Instantly share code, notes, and snippets.

@karson
Last active January 16, 2023 15:25
Show Gist options
  • Save karson/2aa7abf9bbf0d920de76b3b71c354fd9 to your computer and use it in GitHub Desktop.
Save karson/2aa7abf9bbf0d920de76b3b71c354fd9 to your computer and use it in GitHub Desktop.

Revisions

  1. karson revised this gist Jan 16, 2023. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions allow_remote_access.sql
    Original 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'
  2. karson created this gist Jan 16, 2023.
    12 changes: 12 additions & 0 deletions allow_remote_access.sql
    Original 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;