I created a database using 'CREATE DATABASE Gameshop;' for my class and I need to hand it in as an '.sql' file but, I don't know where to look for the file or how to create it.
I am worried I will lose all of my work if I attempt something and fail. Thank you!
In your command prompt (NOT mySQL command line):
Use $ mysqldump -u <username> -p<passwprd> db_name > db_backup.sql
in order to dump the entire database on to an SQL file from the command line.
To import back use $ mysql -u <username> -p -h localhost db_name < db_backup.sql
See manual for more details.
You could export your database using the export wizard of your Database IDE(MySQL Workbench,phpmyadmin, Sequel Pro etc...) or else if you are using command line for single database use
mysqldump database_name > database_name.sql
for Multiple databases
mysqldump --databases database_one database_two > two_databases.sql
for all databases on server
mysqldump --all-databases > all_databases.sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With