Last active
November 10, 2018 00:18
-
-
Save sagax/3de8675602d4c4229300a70fd6ef184c to your computer and use it in GitHub Desktop.
mysql cheat sheet
This file contains 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 characters
# |
This file contains 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 characters
-- 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