Quickly reload a database
I’m mostly posting this to copy/paste when I forget, but it’s useful information nonetheless so lets have at it.
- Delete the database
- Create a new database
- Import SQL file into the new database
Assume the mysql user/pass combo is colin/mypassword and the database is called db123.
mysqladmin -u colin -pmypassword drop db123; mysqladmin -u colin -pmypassword create db123; mysql -u colin -pmypassword db123 < db123_backup.sql
If you’re working on something and you need to reload your database a lot, you can put all the commands on one line (still with semicolons of course) and add -f to the first command to skip the delete check.
Very very basic stuff here, but I’m sure the 3min it took me to write this saved someone else more time than that.
English style decimal marks with a European keyboard layout Compiz – Window border edge overlaps when using the grid plugin
Call it even.