Skip to content

Instantly share code, notes, and snippets.

@jachin
Created September 29, 2011 20:28
Show Gist options
  • Save jachin/1251832 to your computer and use it in GitHub Desktop.
Save jachin/1251832 to your computer and use it in GitHub Desktop.
MySQL Cheat Sheet
# Create database.
CREATE DATABASE some_database_name;
# Create a user with all the priviliges for the database.
GRANT ALL PRIVILEGES ON some_database_name.* TO some_user@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
# Make sure our changes will get used.
FLUSH PRIVILEGES;
# Sorting in descending order.
SELECT * FROM a ORDER BY a.a DESC
# Sorting in ascending order.
SELECT * FROM a ORDER BY a.a ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment