----- Original Message -----
From: "Mark Matthews" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, May 23, 2002 12:24 PM
Subject: Re: newbie - Old Samp_db question


>
> ----- Original Message -----
> From: "Eugene McQuade" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, May 23, 2002 8:42 AM
> Subject: FW: newbie - Old Samp_db question
>
>
> >
> > Victoria
> > Thanks for the quick response.  If I enter what you provided using a
'dos'
> > command, I get "Access is denied".
> >
> > I thought I had to be in Mysql in order to execute the command. So I
enter
> > (in dos) mysql\bin\mysql to get into mysql.  And, I get the 'Welcome to
> the
> > MySQL monitor' message.
> >
> > I type USE samp_db and get the 'Database changed' message.
> >
> > I then type samp_db (because that's the directory sample database is in,
> > right?) < create_president.sql; and I hit return.  I then get Error
1064.
> >
> > Have I misinterpreted the manual?

If you're not familiar with command-line usage under Unix (or Dos), here's a
breakdown of what you should be doing.

c:\mysql\bin\mysql samp_db

is an executable located at "c:\mysql\bin\mysql" being launched from the
command-line, with one argument "samp_db", which tells the mysql client to
"use" the "samp_db" database for all commands issued while using the mysql
client.

When you add to the end of the above line:

< create_president.sql

you are using something called a "redirection operator". When you use the
"<" it means, take everything in the file after the "<" and act like you
typed it in to the command before the "<". (You can also use the ">"
operator to take anything that results from running a command and place it
in a file, btw).

So when you string the two together, you are in essence, operating the mysql
command-line client by "remote control". It will take all of the SQL in the
"create_president.sql" file and "type" it into the mysql command-line
client.

If you start the mysql client, you can't issue the command "samp_db <
create_president.sql;", because it's not valid SQL or any other command that
the mysql client understands. You could do a "source create_president.sql",
which would do about the same thing, but get it working the first way, as
it's very common to do this with command-line applications, especially in
Unix. It's a central concept to get correct, if you're going to be doing a
lot of work with MySQL, or computers in general.

    -Mark



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to