List:General Discussion« Previous MessageNext Message »
From:Johan De Meersman Date:May 26 2010 9:15am
Subject:Re: source backup.sql - troubleshoot
View as plain text  
On Wed, May 26, 2010 at 10:54 AM, <a.smith@stripped> 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

Thread
source backup.sql - troubleshootSydney Puente25 May
  • RE: source backup.sql - troubleshootDaevid Vincent26 May
  • Re: source backup.sql - troubleshootRob Wultsch26 May
  • Re: source backup.sql - troubleshoota.smith26 May
    • Re: source backup.sql - troubleshootJohan De Meersman26 May
      • Re: source backup.sql - troubleshoota.smith26 May
        • Re: source backup.sql - troubleshootJohan De Meersman26 May
          • Re: source backup.sql - troubleshootSydney Puente26 May
            • Re: source backup.sql - troubleshootJohan De Meersman26 May
              • Re: source backup.sql - troubleshootSydney Puente26 May
                • Re: source backup.sql - troubleshootJohan De Meersman26 May
                  • Re: source backup.sql - troubleshootSydney Puente26 May
                    • Re: source backup.sql - troubleshootJohan De Meersman26 May
            • Re: source backup.sql - troubleshootDimitre Radoulov26 May