?
Solved

MySQL import problem

Posted on 2011-09-15
18
Medium Priority
?
410 Views
Last Modified: 2012-05-12
I have a file that i have to import to mysql via the terminal app in mac.

the file is called db.bz2 and resides in directory : mysql-5.5.15-osx10.6-x86

using the terminal app i cd into mysql-5.5.15-osx10.6-x86, then run this command:
mysql -u root -p db < hp2.bz2

but i get this error:
db.bz2: No such file or directory

when I do an ls i know I am in the directory and the file resides there - any idea what i am doing wrong?


0
Comment
Question by:lvollmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 4
  • +1
18 Comments
 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 36543504
Add ./ to the filename
0
 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 36543521
To clarify:
mysql -u root -p db < ./hp2.bz2
0
 

Author Comment

by:lvollmer
ID: 36543703
when i try that, i get > -bash: mysql: command not found

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 36543755
That means your mysql is not in the path. The easiest thin is to just use the full path of the mysql installation.

according to
http://dev.mysql.com/doc/refman/5.0/en/macosx-installation.html
By default it is at
/usr/local/mysql/
0
 

Author Comment

by:lvollmer
ID: 36543792
same thing > -bash: mysql: command not found
0
 

Author Comment

by:lvollmer
ID: 36543896
when i ls the /usr/local/mysql/ dir

here are the files

COPYING            bin            hp2.bz2            man            share
INSTALL-BINARY      data            include            mysql-test      sql-bench
README            docs            lib            scripts            support-files


the db file is in there for sure.
0
 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 36544077
I don't have a Mac in front of me at the moment so I'm not really any more help. I think it's something like this from the folder with the db:
/Usr/local/mysql/mysql -u root -p db < ./hp2.bz2
0
 
LVL 60

Accepted Solution

by:
Kevin Cross earned 2000 total points
ID: 36544116
The mysql command is probably under bin so please credit aarontomosky for directing you correctly, but think it should be:

/usr/local/mysql/bin/mysql -u root -p db < ./hp2.bz2

Open in new window


This would be if you are running "from the folder with the db," i.e., /usr/local/mysql/data. If you first:

cd /usr/local/mysql/

Open in new window


Then:
./bin/mysql -u root -p db < ./data/hp2.bz2

Open in new window


See if one of those options works for you.
0
 

Author Comment

by:lvollmer
ID: 36544271
mwvisa1

 I had to move the file to this directory > /Applications/XAMPP/xamppfiles/var/mysql

this is where the active mysql is. how can i modify your cmd for this?
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 36544368
Where is the data file in relation to that directory? If structure is similar to what you showed before, then you can simply use a different CD command:

cd /Applications/XAMPP/xamppfiles/var/mysql/

Open in new window


MySQL command is likely still under bin and database is likely still under data. Just guesses, though, so correct those for your proper data directory/file location.

./bin/mysql -u root -p db < ./data/hp2.bz2

Open in new window

0
 

Author Comment

by:lvollmer
ID: 36544576
still getting -bash: ./data/hp2.bz2: No such file or directory

when i ls /Applications/XAMPP/xamppfiles/var/mysql

I get:

ib_logfile1
cdcol                        ibdata1
devmac.err                  l@002dhp
houseparty2                  mysql
l_lab                  mysql.sock
l_lab_test            surveys
                  test
hp2                        testapp
hp2.bz2

so I know the file is in that directory
0
 

Author Comment

by:lvollmer
ID: 36544593
what data file do you need me to look for?
0
 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 36544631
You moved it. I can see it right there in the ls results  It's not ./data/hp2.bz2
It's ./hp2.bz2
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 36545037
I agree. Your mysql command is there too, so no bin. Run it as shown here: http:#a36543521 (after changing directories to /Applications/XAMPP/xamppfiles/var/mysql )
0
 

Author Comment

by:lvollmer
ID: 36545204
so to clarify I am doing this:

cd /Applications/XAMPP/xamppfiles/var/mysql

followed by this:

mysql -u root -p db < ./hp2.bz2

Because when I do that, I still get this error:
-bash: mysql: command not found
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 36545866
Wish I had a Mac handy also. See if this helps: http://dev.mysql.com/doc/refman/5.0/en/macosx-installation.html -- shows how to alias path to mysql. Other recommendation in the document is as was suggested, which is add to your path. It shows calls using sudo also, so you can try:

sudo mysql -u root -p db < ./hp2.bz2

But you may still need to alias mysql. The examples all show /usr/local/mysql/bin/mysql, so not sure if some remnants of the application are there even though you moved others.
0
 

Author Comment

by:lvollmer
ID: 36549230
i will give this a shot, thanks
0
 
LVL 3

Expert Comment

by:pete-mcpetey
ID: 37819346
Plain Text for Import.
First issue is that you are using a bz2 file. If this is a compressed file, it won't work. You need it to be in standard text for MySQL to import it.
Check if this is a text file or binary (compressed) file:
head ./hp2.bz2

Open in new window

If this doesn't work, try this command to extract it
bunzip2 ./hp2.bz2

Open in new window

You can use other commands but might want to just use a graphic one:
http://www.macupdate.com/app/mac/14503/gui-tar
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this article, we’ll look at how to deploy ProxySQL.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

800 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