MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 13th, 2006, 04:02 PM
conchheads conchheads is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 5 conchheads User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 27 sec
Reputation Power: 0
Source Command

I have tried many, many ways to get the source command to work on a simple file, create.sql. The command line client always returns "failed to open file 'c:\sql\create.sql', error 2".

I have tried putting the file in \bin, \scripts, c:\sql, \mysql server 5.0, reversing the slash, all to no avail. I have even attempted to invoke the file from a command prompt using, 'mysql -u root -p db_name <create.sql' and all it's possibilities with the consistent response, 'the system cannot find the file specified'.

If I use a ; at the end of the line, I get some version information and an error 1064 .... in correct syntax at line one. I assume that is in reference to the " ; ".

I have modified the text file with even simpler commands.

The funny thing is, the commands in the text file work great (if I don't have a typo) when I enter them individually at mysql> , but I'm tired of repetitive typing to learn mysql.

Oh, I checked the global variable basedir which came back c:\program files\mysql\mysql server 5.0. Of course I tried putting the file create.sql there?!?

Can anyone help me solve this? I'd like to move on to harder things I know this sounds confusing, I've done a lot of troubleshooting. Thanks for reading and replying.

Reply With Quote
  #2  
Old July 18th, 2006, 06:54 AM
Gord Gord is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 1 Gord User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 sec
Reputation Power: 0
Spent all day yesterday with the same problem.
Tried again today & is working fine.Maybe mysql needed to be shutdown or maybe I was using faulty syntax ??

Win 2000 / mysql 5.0

1. Create a simple test file called
batchtest1.sql or
batchtest1.txt or
batchtest1.bat.

save the file in your c:/mysql folder.


In the Command :

mysql> source c:\mysql\batchtest1.sql

Worked for me.

Hope this helps

Gord

Reply With Quote
  #3  
Old July 18th, 2006, 07:28 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 997 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2Folding Points: 906075 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 14 h 26 m 27 sec
Reputation Power: 5
Send a message via ICQ to Itsacon
Is the file on the same (physical) machine as the MySQL server (in other words: are you connecting to localhost). If it isn't, you can't use the source command, or you'll have to upload the file first using FTP.
__________________
This is my code. Is it not nifty?

"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams


Join the Itsacon fanclub!    
Zero Tolerance: Spammers banned so far: 280

Reply With Quote
  #4  
Old July 20th, 2006, 03:49 PM
conchheads conchheads is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 5 conchheads User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 27 sec
Reputation Power: 0
Source on Localhost

Quote:
Originally Posted by Itsacon
Is the file on the same (physical) machine as the MySQL server (in other words: are you connecting to localhost). If it isn't, you can't use the source command, or you'll have to upload the file first using FTP.


I am attempting to use 'source' from the localhost. (ie the same physical machine as the server.

This is the command I use to get to mysql>. Maybe the problem lies here. At the command prompt I enter:
mysql -u root -p
and then enter the password. I'm wondering if it's a server setting issue ??

I tried again today by renaming the file .txt and .bat as suggested earlier, still getting the message "failed to open file 'c:\sgl\test.sgl', error: 2"

Please continue to offer suggestions.

Thanks
David

Reply With Quote
  #5  
Old July 20th, 2006, 03:52 PM
conchheads conchheads is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 5 conchheads User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 27 sec
Reputation Power: 0
Thanks Gord for taking the time to check it out and respond. I'm sorry you too spend so much time on it. I'm still not getting the file to open and work.

Can you provide any further info to what gave you sucess?

Thanks,
David

Reply With Quote
  #6  
Old September 8th, 2007, 09:02 AM
davestro davestro is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 1 davestro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 37 sec
Reputation Power: 0
Quote:
Originally Posted by conchheads
Thanks Gord for taking the time to check it out and respond. I'm sorry you too spend so much time on it. I'm still not getting the file to open and work.

Can you provide any further info to what gave you sucess?

Thanks,
David



I know this is in older post, but I had the same issue.

The way I got it to work was put the .sql file in the bin directory and the the command like this:

mysql> SOURCE create_tbl.sql;

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Source Command


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT