This is just to save some mysql command that sometimes I forget. The store is good for me when I need to look back and copy paste.
1. Faster import sql file
1 2 3 |
mysql> set autocommit=0; set unique_checks=0; set foreign_key_checks=0; mysql> source /path/to/dump.sql mysql> commit; set unique_checks=1; set foreign_key_checks=1; |
Export and Compress sql file:
1 |
mysqldump -u [uname] -p[pass] [dbname] | gzip -9 > [backupfile.sql.gz] |
Decompress and Import:
1 |
gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname] |
Create new user and pass:
1 |
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; |
Grant privileges:
1 2 3 |
GRANT ALL PRIVILEGES ON `jaap\_%` . * TO 'jaap'@'localhost'; GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost'; |
List of the “in progress” process:
1 |
show processlist |