Below are some commands that are usefull when working with MySQL databases. The commands are here as a reminder to myself. I do not intend to write a long articles on how and why they work. Squar brackets and the text inside needs to be replaced with your own informatin, meaning you only type the square brackets if it is part of the username or database name.
Create user with access to everything
mysql> GRANT ALL PRIVILEGES ON . TO '[username]'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
Backup all databases
$ mysqldump -u [username] -p --all-databases > dumpfile.sql
Backup selected databases
$ mysqldump -u [username] -p [database name] > dumpfile.sql
Restore all databases
$ mysql -u [username] -p < dumpfile.sql
Restore selected databases
$ mysql -u [username] -p [database name] < dumpfile.sql