SQL backup and restore

dump the database with mysqldump:

mysqldump -A -a -p > [FILE]

store it, move it to the new server or do whatever is needed...

insert the table by starting the mysql client:

mysql -p

and run the file with the \. cmd:

\. [FILE]

This doesn't overwrite tables which already exists. 
If you need to restore some of the content this method is not advisable.

If you've just installed the mysql daemon again, you don't need to run the
'./scripts/mysql_install_db' command. All this command does is to create 
the 'mysql' table, which you've also got in the file with the backup.
Dette indlæg blev udgivet i Knowledge Base, SQL. Bogmærk permalinket.

Skriv et svar