05.15
I decided today to take a backup of a database in the usual way using phpmyadmins export facility. I exported it to a zip file and called it topgame.zip i then ftp’d it to the location on the server i wanted.
I then decided that i wanted to mysqldump this database using the terminal, which ive never done before but which is much quicker and more reliable than using phpmyadmins built in import function.
So here we go……………..
Step 1 : Unzip the file that you ftp’d to the server which contains your backup database
unzip myuser_db_sometable.zip
Step 2: Login into your mysql database using terminal
mysql -u mysql_username -p
Step 3: You will be prompted for your password for mysql, enter it and hit enter, note(you will not see any characters going in).
Step 4: Enter the database name that you want to add the backup into or create a new database
Step 5 (optional): Create a database from command line
mysqladmin create db_name
Step 6: Once the table is there select the table:
use db_name
Step 7: Once the table is there select the table:
\. myuser_db_sometable.zip
Step 8: then simply quit out of the mysql console using
\q
Step 9: For help using the mysql console:
\h
I hope someone finds this useful, its very simple and can save loads of time.
You can actually do this all on one line if you want with the following:
unzip -p mydb.zip | mysql -u USER -pPASS -D dbname