Skip to content

Instantly share code, notes, and snippets.

@vdvm
Created December 23, 2014 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vdvm/afed584a7822afe15c47 to your computer and use it in GitHub Desktop.
Save vdvm/afed584a7822afe15c47 to your computer and use it in GitHub Desktop.
mysql_secure_installation queries

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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment