LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-24-2010, 03:44 PM   #1
bbrian017
Member
 
Registered: Dec 2009
Posts: 59

Rep: Reputation: 15
Inserting mysql database using shh putty


I've down loaded mysql database file and now I'm looking at adding it into a new dedicated server.

Should I upload that sql file to the root folder I created for the domain and insert it with shh like that?

If not where should I upload this mysql file to insert it to the new database. It's rather large so I have to use SHH

Fir example if this is the code,

Code:
mysql -uUSERNAME -pPASSWORD DATABASENAME < MYDATABASE.sql
where is that actual location of MYDATABASE.sql

Thanks,

Brian
 
Old 07-24-2010, 03:50 PM   #2
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
wherever you like ... the "<" character is just a shell redirection, meaning it "feeds" the file "MYDATABASE.sql" as input to the command mysql. You can delete the original file after command execution, mysql stores the contents in its database files.
 
1 members found this post helpful.
Old 07-24-2010, 03:53 PM   #3
bbrian017
Member
 
Registered: Dec 2009
Posts: 59

Original Poster
Rep: Reputation: 15
ok so I'm sitting here connected with putty to my new server. I haven't added any domains yet. I'm about to add my first domain name and the system will create it's database etc for me. Where do I upload this MYDATABASE.sql so I can insert it to the new database? Do I upload it in the new domain nanes root folder?

if so what would be my path public_html/MYDATABASE.sql

Last edited by bbrian017; 07-24-2010 at 03:54 PM.
 
Old 07-24-2010, 03:55 PM   #4
blue_print
Member
 
Registered: May 2010
Location: In world
Distribution: RHEL, CentOS, Ubuntu
Posts: 275
Blog Entries: 3

Rep: Reputation: 50
Well, if you want to upload that SQL to your server, you'll have to use scp, ftp or sftp!
 
1 members found this post helpful.
Old 07-24-2010, 03:58 PM   #5
bbrian017
Member
 
Registered: Dec 2009
Posts: 59

Original Poster
Rep: Reputation: 15
Yes I have an ftp program. So to confirm I upload it to the root public_html folder for this specific domain and use
Code:
mysql -uUSERNAME -pPASSWORD DATABASENAME < public_html/MYDATABASE.sql
 
Old 07-24-2010, 04:02 PM   #6
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
you upload it WHEREEVER YOU WANT, it doesn't matter. As I said, you can delete the file after importing it
 
Old 07-24-2010, 04:16 PM   #7
bbrian017
Member
 
Registered: Dec 2009
Posts: 59

Original Poster
Rep: Reputation: 15
I uploaded it to the root of this new domain which I think is /public_html/ when I used the code inside putty,

mysql -uUSERNAME -pPASSWORD DATABASENAME < public_html/MYDATABASE.sql

it says no such file or directory. I'm logged in as root using putty
 
Old 07-24-2010, 11:38 PM   #8
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Your problem is the "I think" in the opening line of post #7

Try to find the file first using the find command
Code:
fortyfourgalena@desktop1:~$ find . -name "mini*" -print
./work/miniconlog_verifier
./progs/minirc.ttyp0_9600_8n1
./minicom.log
Replace mini* by the name of your database
 
Old 07-25-2010, 02:27 AM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,372

Rep: Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382
Code:
find / -iname MYDATABASE.sql -print
As above said, if you don't KNOW where you put the file, don't guess, find it. Anyway, your ftp tool should tell you where you are putting stuff....
Either cd to that dir or use the full absolute path.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
inserting the content of a python list to a mysql database jwnjoroge Linux - Newbie 1 09-09-2009 06:51 AM
Problem Inserting Data In A Mysql Database Using PHP Dapernia Programming 5 09-17-2007 10:05 AM
I need help with inserting data into mysql w/ PHP lostboy Programming 3 08-25-2003 12:08 PM
inserting data in mysql zuessh Linux - Software 4 05-19-2003 01:00 PM
MySQL - Inserting Data Not Happening! Rhapsodic Programming 4 10-26-2002 10:58 PM


All times are GMT -5. The time now is 02:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration