View Full Version : Baseball

08-09-2006, 07:20 PM
Hey guys,

I'm new at SQL and feel hopeless right now with it.

I recently got a book about baseball statistics...and it talks about downloading a database for MYSQL. After decompressing the file he says I should do this......

1 ~ % mysql -p -u root
2 Enter password:
3 Welcome to the MySQL monitor. Commands end with ; or \g.
4 Your MySQL connection id is 22 to server version: 4.0.21-standard
6 Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
8 mysql> GRANT ALL ON bbdatabank.* TO 'root'@'localhost' IDENTIFIED BY 'P@ssw0rd';
9 Query OK, 0 rows affected (0.07 sec)
11 mysql> CREATE DATABASE bbdatabank;
12 Query OK, 1 row affected (0.00 sec)
14 mysql> quit
15 Bye

That seems to work ok...but the next step is where I get stuck.

The file I unzipped was called BDB-sql-2005-08-02.sql. You can import this in a single step using this command (you will need to use the same username and password you used in the previous step):

~ % mysqlu jadler -p -s bbdatabank < BDB-sql-2005-08-02.sql
Enter password:P@ssw0rd

The < sign means "read the filename to the right and send it to the program to the left."

I never get the Enter Password part...all I get is this

Any help would be greatly appreciated...I've been trying to figure this out the last 3 days.


08-09-2006, 08:39 PM
Do you have a space between mysql-u when you type it for real? (you should have...)

and you are entering this from the bash/dos/whatever command-line, rather than after you've entered mysql?

08-09-2006, 09:04 PM
Before going any further I'd suggest you upgrade to mysql 4.1 at a minimum, it supports subqueries and group_concat among other items that will most likely be useful. the current version of mysql is 5.0.22 and it supports even more items not available in 4. if you are not worried about having the same version as on a hosted machine then I'd say upgrade to mysql 5.

08-09-2006, 10:46 PM
Hey guys,

Thanks for getting back to me so quickly. A few things that may help you help me figure this out.

-I am using MYSQL 5

-When MYSQL starts the very first thing it asks for is a password. How do I get it into the "dos" menu you were talking about, so I can input the code I am having trouble with.

Thanks for all the help!

08-09-2006, 10:52 PM
if you're running windows, then you get the command-line (it's not actually dos in 2k/xp, just in case any pedants turn up...) by clicking 'start', then 'run' then typing 'cmd' and pressing enter.
this is where you run the import from
(on linux, you'll either be logged in on a command-line, or you can start a terminal from one of the menus).

08-10-2006, 01:30 PM
-I am using MYSQL 5

Well this line above:
Your MySQL connection id is 22 to server version: 4.0.21-standard

seems to suggest otherwise.

08-10-2006, 07:16 PM
I read it like that at first as well, but re-reading, I think that the bits of terminal output are copied from the guide he is following.

08-10-2006, 09:11 PM
Hey guys,

First I upgraded my mysql..thanks

I tried punching it in the command line...and it says "the file specified does not exist". Could I be doing my username wrong? It says my username is "root"

Any other tips? Thanks for the help so far!

08-10-2006, 11:51 PM
it means exactly what it says, the file you're trying to import isn't where you're telling mysql to look.
YOu either need to use 'cd' to change directory to the location of the file, e.g.
cd C:/Documents & Settings/Administrator/Desktop
(or wherever)
or provide a full file-path to myqsl
mysql --user=root --password --database=database < C:/Documents & Settings/Administrator/Desktop/file.sql