Re: system(): access denied
| From: | Chris Boget | Date: | Thu, 16 Jan 2003 15:54:59 +0000 |
| Subject: | Re: system(): access denied | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131884@lists.php.net to get a copy of this message | ||
> > system("mysql -uroot -p < the_dump_file.sql")
> > it doesn't know where the command ends and the input
> > begins. So what's going on is that the command thinks
> > that the password is coming from the "the_dump_file.sql".
> It knows exactly where the command ends and the input
> begins. It is the < symbol. :-)
Ok, I wasn't sure. It just seemed like it could go either way.
> Also, in your example (which strays from the poster's
> example),
No. They both do the same thing. They take the data from
the .sql file and make mysql use it.
> once you provide the password (which it prompts for). It
> does not try to use it for the password as you seem to be
> thinking.
Again, it seemed like it could go either way. :p
> Anyway, the reason the poster wrote it like this:
> mysqldump -uroot -p > the_dump_file.sql
> is so that the output of mysqldump (the dump file) is sent
> to the_dump_file.sql rather than stdout.
Right. And the problem the original poster had was getting
mysql use that data that mysqldump dumped. This is the
problmatic command:
system("mysql -uroot -p < the_dump_file.sql")
and that is the same thing as this:
system( "cat the_dump_file.sql | mysql -uroot -p" );
just doing it a different way. It just clears up any kind of
ambiguity w/r/t what the "the_dump_file.sql" is being used
for.
Chris