SQL for beginners! How do you backup and restore a db?
I haven't seen any decent sites on it yet and I can't find anyone locally who uses it still (everyone says "I used to know how to do that...")
Looking at what ChaosSlayerZ did below I can see how to multiply something by a value, but I'm not sure how to set something to a constant. "update loottable_entries set multiplier=multiplier*2;" I suspect it's something like Code:
UPDATE `PEQ`.`items` SET `loregroup`='0'; Can anyone tell me how to backup/restore, and if they think my code makes sense? Or at least of a decent training website that covers that sort of thing? I guess backup/restore is the main thing. |
I do my backups/restores via the command prompt.
To backup, use mysqldump. My database in this example is called ykesha rather than peq, so wherever you see ykesha, change it to peq or whatever you called your database: Code:
C:\Users\Steve>mysqldump -u root -p ykesha > ykesha-backup.sql In the event you wanted to restore that backup, you would go into the mysql command line tool, drop the database and re-create it (empty) and then source in the backup you made earlier, e.g.: Code:
C:\Users\Steve>mysql -u root -p Code:
C:\Users\Steve>mysql -u root -p |
Thanks very much, I'll give it a go!
|
Also, if you use Navicat for managing your database, you can just right click on the database and select the "Dump to SQL" option. Then, chose a name to save it as and run it. That will back the DB up just like the command prompt way that Derision described.
Then, to restore your database, you can just right click on the database in Navicat and select the "Run Batch File" option (not sure if that is the exact name of the option, but it is something like that). Then, select the backup you wish to restore to and run it. |
Something else to note is the --opt flag in MySQL. It makes sourcing a lot faster with MySQLDump as it does more than one entry per line, amongst other things.
Code:
mysqldump -u root -p ykesha --opt |
|
All times are GMT -4. The time now is 01:22 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.