Skip to content

Instantly share code, notes, and snippets.

@vdvm
Created December 23, 2014 15:01

Revisions

  1. vdvm revised this gist Dec 23, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions mysql_secure_installation.md
    Original file line number Diff line number Diff line change
    @@ -24,8 +24,8 @@ DROP DATABASE test;
    DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'
    ```

    ```
    Reload privilege tables:
    ```

    FLUSH PRIVILEGES;
    ```
    FLUSH PRIVILEGES;
    ```
  2. vdvm created this gist Dec 23, 2014.
    31 changes: 31 additions & 0 deletions mysql_secure_installation.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    Set root password:

    ```
    UPDATE mysql.user SET Password=PASSWORD('mysecret') WHERE User='root';
    FLUSH PRIVILEGES;
    ```

    Remove anonymous users:

    ```
    DELETE FROM mysql.user WHERE User='';
    ```

    Disallow root login remotely:

    ```
    DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
    ```

    Remove test database and access to it:

    ```
    DROP DATABASE test;
    DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'
    ```

    ```
    Reload privilege tables:
    ```

    FLUSH PRIVILEGES;