Skip to content

Instantly share code, notes, and snippets.

@sagax
Last active November 10, 2018 00:18
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 sagax/3de8675602d4c4229300a70fd6ef184c to your computer and use it in GitHub Desktop.
Save sagax/3de8675602d4c4229300a70fd6ef184c to your computer and use it in GitHub Desktop.
mysql cheat sheet
-- show databases size
SELECT table_schema AS "Database", ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema;
-- create user with privileges
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON databasename.* TO 'username'@'localhost';
FLUSH PRIVILEGES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment