Re: Scripting MySQL Commands
Hy Steve, bin/mysql -p bin/mysql -p /[the complete pathname, honest]/Temp.sql try the following command : bin/mysql -p /[the complete pathname, honest]/Temp.sql HTH Oliver - 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
Re: Scripting MySQL Commands
Oliver, Thanks for responding. Foolish of me to be in such a rush that I wasn't watching what I was copying and pasting. I actually did use the command you suggest below. And that's what drew the error message. So I'm back to the drawing board. Take care, and thanks again-- Steve Hy Steve, bin/mysql -p bin/mysql -p /[the complete pathname, honest]/Temp.sql try the following command : bin/mysql -p /[the complete pathname, honest]/Temp.sql HTH Oliver
Re: Scripting MySQL Commands
At 8:53 -0500 3/2/03, [EMAIL PROTECTED] wrote: I'm doing all kinds of exercises and tutorials to get up to speed on MySQL on my PowerBook with OS X.2 running. I just tried an exercise that, for the first time, had me creating a table not right in the MySQL monitor, but, rather, via a script that I saved as a textfile--Temp.sql--and then call the script up from the command line in the MySQL monitor. Here's the script: CREATE DATABASE Temp; USE DATABASE Temp; CREATE TABLE Test_Table (Test_ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Test_Name VARCHAR(30), Test_Date DATETIME, Test_Giver VARCHAR(30)); INSERT INTO Test_Table (Test_ID, Test_Name, Test_Date, Test_Giver) VALUES (NULL, 'Test','2000-03-02','Etienne'); The line I used to call the script up is: bin/mysql -p bin/mysql -p /[the complete pathname, honest]/Temp.sql I didn't get the expected result, receiving the following message: ERROR 1064: You have an error in your SQL syntax near 'bin/mysql -p /Users/stephent/Sites/Temp.sql' at line 1 Can anyone see what I've done wrong? Type the command at the shell prompt, not after you've already invoked mysql. The error message is from mysql itself; it indicates that you typed a shell command to mysql. Thank you. Steve Tiano mail2web - Check your email from the web at http://mail2web.com/ . - 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
Re: Scripting MySQL Commands
Paul, Thanks very much for responding. I tried what you suggested, but got: ERROR 1102: Incorrect database name '/Users/stephent/Sites/Temp.sql' I don't get this. What wrong database name? The script is supposed to create the database and a table in it. What an I too dense to see? Thanks again-- Steve Tiano Type the command at the shell prompt, not after you've already invoked mysql. The error message is from mysql itself; it indicates that you typed a shell command to mysql. - 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
Re: Re: Scripting MySQL Commands
Hy Steve, USE DATABASE Temp; try to change this into : USE Temp; and try it again, this should work. HTH Oliver for the filter : sql,query,queries,smallint - 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
Re: Scripting MySQL Commands
Guys, Guys-- I got it! I stopped being a dimwit long enough to realize that the change to USE Temp; below was for INSIDE the script. When I made that change and again went to a new shell and typed (actually, I dragged the file from the window in which it sat in the Finder into the Terminal after typing): /usr/local/bin/mysql -u [name] -p /Users/[my username]/Sites/Temp.sql I entered my password, was presented with a new prompt and typed: /usr/local/bin/mysql -u [name] -p Again I was asked for my password, which I typed in. At the next prompt I typed USE Temp. The database changed and at the prompt that followed, I typed SHOW TABLES. Test_Table was there. I did a SELECT * FROM Test_Table and the test row of data was indeed there. Thank you all-- Steve - 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
Re: Scripting MySQL Commands
I'm fairly new to MySQL as well (although, I do have experience with Oracle). Even though you create a new database doesn't mean that MySQL will automatically start using that database. After all you might want to create 10 or 15 databases all at once (why? I don't know), then start creating tables for the 5th one you created. So your script needs to do something like: create database 'Temp'; use 'Temp'; (You need the quotes [or maybe it's the backquotes] if you actually want a mixed case name.) I'm sure that if I'm off, someone here will correct me. jeff At 12:27 -0500 3/2/03, Stephen Tiano wrote: Paul, Oliver-- I really, really appreciate you guys taking time from your respective Sundays to try and enlighten me. But I'm still getting nowhere fast. I've gotten it to this: I open a new shell and type: /usr/local/bin/mysql --local-infile -u root -p [the full pathname up to]/Temp.sql at which point it informs me incorrect database name. Well, yes, the script is to create a nonexistent database and then a table called Temp in that database. I'm now officially lost. 'use' would only apply to an existing database. By the way, I've also tried: /usr/local/bin/mysql -u root -p [the full pathname up to]/Temp.sql to no avail. S frustrating ... Steve Tiano - 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 -- Jeff Shapiro, Colorado Springs, CO, USA At work I *have* to use a Windows machine, at home I *get* to use a Mac. - 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
Re: Scripting MySQL Commands
At 12:25 -0500 3/2/03, Stephen Tiano wrote: Paul, Oliver-- I really, really appreciate you guys taking time from your respective Sundays to try and enlighten me. But I'm still getting nowhere fast. I've gotten it to this: I open a new shell and type: /usr/local/bin/mysql --local-infile -u root -p [the full pathname up to]/Temp.sql at which point it informs me incorrect database name. Of course. The first non-option argument, if there is one, is taken as the name of the default database. You need a character before the filename if you want to redirect the input of the command to read from the file: /usr/local/bin/mysql --local-infile -u root -p filename Well, yes, the script is to create a nonexistent database and then a table called Temp in that database. I'm now officially lost. 'use' would only apply to an existing database. By the way, I've also tried: /usr/local/bin/mysql -u root -p [the full pathname up to]/Temp.sql to no avail. S frustrating ... Steve Tiano - 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