[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

PERL DBI MYSQL Import .sql into MySQL using PERL DBI

Posted on 2007-03-29
3
Medium Priority
?
1,028 Views
Last Modified: 2012-05-05
I am having trouble importing a .sql file (created from a MySQL export). I was using the following code on a unix box but it doesn't work on a win* box so I am thinking PERL DBI but I wasn't finding any clues.

my $imp=`mysql  --user='$db_user' --password='$db_pass' $db_name < $db_file 2>&1 `;
0
Comment
Question by:Bob-Villa
3 Comments
 
LVL 39

Expert Comment

by:Adam314
ID: 18818399
Does the command work if you run it from the command line?
Do $db_user, $db_pass $db_name and $db_file all have the correct values?
0
 
LVL 19

Accepted Solution

by:
Kim Ryan earned 2000 total points
ID: 18820576
I think the problem is with the redirection of STDERR, the  2>&1 part, it has no meaning is Windows

Try this line:
my $imp=system("mysql  --user=$db_user --password=$db_pass $db_name < $db_file");
0
 
LVL 1

Author Comment

by:Bob-Villa
ID: 18843439
Well, it seems that I had 2 problems.
1. Even though mysql is in my server's path I needed to specify the full path to mysql (C:/mysql/bin/mysql)

2. Win* did not like the ' quotes surrounding my username/password.

using teraplane's system example I was able to see the system errors print to screen and it technically was the correct answer for the question posted.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this article, we’ll look at how to deploy ProxySQL.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question