On Wed, May 26, 2010 at 10:54 AM, <a.sm...@ukgrid.net> wrote:

>
> Actually Im assuming a DB name of "source", which I mentioned in my first
> post. Thats actually an bad assumption as, as Ive just read, source is an
> alternative way to read in data from a file that Id never seen before.
> However the syntax would still seem to be bad, assuming the command is being
> run from the command prompt as opposed to the mysql command prompt.
> According to the man page the two options from the command prompt are:
>
>       shell> mysql db_name < backup-file.sql
> OR
>       shell> mysql -e "source /path-to-backup/backup-file.sql" db_name
>

Ahh :-)

It is quite possible for the backup file to contain a "use mydatabase"
statement - I usually do this, makes my restores easier. The clause is added
automatically by mysqldump if you use the --databases parameter.

It could be argued, however, that this allows accidental restores of a
production database, whereas the omittance of the use clause means that the
client will barf as soon as you start the restore without target db
specification, because you're trying to create objects outside of a
database.

Both approaches are valid.


-- 
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel

Reply via email to