473,326 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

trouble with mysql source command

hello. i am running mysql5 on mac osx 10.5. i am new to both of these. i have created a sql script file and i am trying to use it with the sql SOURCE command. when i execute the command: SOURCE mySqlScript.txt; i get the error: Failed to open file 'mySqlScript.txt', error: 2. i have placed this file in the /usr/local/mysql/bin directory. i have also tried adding the full path name to the script file and get the same result. where should this file be located? i would sure appreciate some help. thanks
Nov 6 '08 #1
7 16772
i think the command to run afile is
sql>@drive name:\\filename.sql
for example:
Sql>@c:\\ab.sql




ITS OWN XP operating system
Nov 6 '08 #2
r035198x
13,262 8TB
Read the reference manual to find out how it is done.
Nov 7 '08 #3
Read the reference manual to find out how it is done.

thank you. i have read the reference manual several times. i follow the instructions exactly for using the SOURCE command. what i need to know is the location of the script file.
Nov 7 '08 #4
hello. i have read the sql manual and the tutorial and i believe that i am doing exactly as instructed

i am running mysql5 on mac osx 10.5. i have created a sql script file and i am trying to use it with the sql SOURCE command.

when i execute the command: SOURCE mySqlScript.txt;
i get the error: Failed to open file 'mySqlScript.txt', error: 2.
i have placed this file in the /usr/local/mysql/bin directory which i believe is where mysql is located.
i have also tried adding the full path name to the script file and get the same result.

i'm wondering:
1) where the script file is supposed to reside
2) does it have to be named a certain way
3) what is error: 2?

i would very much appreciate some help with this. thanks
Nov 8 '08 #5
mwasif
802 Expert 512MB
Providing full path should resolve the problem. Try mysql command instead described here

e.g.
shell> mysql db_name < text_file
Nov 9 '08 #6
solution to this is:

before logging to mysql, first change directory to the path where your batch/script file is located, i.e, if your script file is hello.bat located in your desktop, then change directory to C:\Users\username\desktop. Then login to mysql using mysql -u username -p. now try using the source command:

mysql> source hello.bat

or

you can drag drop your script file for the full path as in

mysql> source C:\users\username\desktop\hello.bat

Very important: donot use a semicolon(;) after this command. Also, there are no quotes to be specified for the filename or path.
Hope it works!!
Oct 5 '10 #7
I had the same problem with the SOURCE command on a Perl/MySQL/Linux system. Solution: I called mysql in interactive mode using a system call from my perl script.
NOTE that the redirection operator (<) seemed to do the job.

...perl code...
system("/opt/lampp/bin/mysql --user=$usr --password=$pwd < $sql_file
exit
")
...more perl code...
Nov 25 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
3
by: Ron King | last post by:
When I installed Mandrake 10.0 I thought I had Apache, PHP, and MySQL installed correctly. I could serve web pages, MySQL worked, and when I tried the phpinfo() function, I got a page that looked...
0
by: Lenz Grimmer | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, MySQL 4.0.14, a new version of the popular Open Source/Free Software Database, has been released. It is now available in source and binary...
0
by: Mark Adams | last post by:
I am a relative newbie to MySQL. I had a Postfix+Courier+MySQL mail server running for several months. It took me a week or so to get it up and running in September. Now, I did a clean upgrade to...
0
by: Mark Adams | last post by:
I am a relative newbie to MySQL. I had a Postfix+Courier+MySQL mail server running for several months. It took me a week or so to get it up and running in September. Now, I did a clean upgrade to...
7
by: MLH | last post by:
I have an sql script file that is supposed to create a set of database tables for me. Supposedly I type the following on my linux box and its all supposed to work... mysql (ENTER) \....
4
by: MLH | last post by:
I am having failures processing the following command and I wonder if you can tell me what I must do in order to have success. When I try to run source mysql_dump.sql.txt ==> it is a problem...
4
by: 21novembre | last post by:
Hi all, I got a quite strange problem when I tried to setup a database backup shell. I put it this way: "bin/mysqldump --opt --user=xxx --password=xxx DB > DB.bak" However, error 1045 came to...
3
by: apostolosl | last post by:
Hi there. I need to update a remote database from a local one. I use mysqldump in my php page in order to create a file for each table, like this: $command="mysqldump table_products >...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.