Last active
August 29, 2015 13:57
-
-
Save miguelfrias/9913546 to your computer and use it in GitHub Desktop.
Mysql Tips & Tricks
This file contains hidden or 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
# Create user | |
CREATE USER user IDENTIFIED BY 'password'; | |
# Create and user (if doesn´t exist) and grant permissions | |
GRANT ALL ON *.* TO 'user'@'localhost' IDENTIFIED BY 'password'; | |
# Update | |
UPDATE [table] SET [table_field]=[new_value] WHERE [id]=[id]; | |
# Change user password | |
SET PASSWORD FOR 'user'@'host' = PASSWORD('newpass'); | |
# Backup just one row | |
> mysqldump -u root -p'password' --compact --no-create-info --where="{field}={value}" {database} {table}; ## The --compact produces a less verbose output (it doesn't drop or lock the table and skips comments). The --no-create-info stops the dump including SQL to recreate the table. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment