LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Inserting mysql database using shh putty (https://www.linuxquestions.org/questions/linux-newbie-8/inserting-mysql-database-using-shh-putty-821938/)

bbrian017 07-24-2010 03:44 PM

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

zirias 07-24-2010 03:50 PM

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.

bbrian017 07-24-2010 03:53 PM

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

blue_print 07-24-2010 03:55 PM

Well, if you want to upload that SQL to your server, you'll have to use scp, ftp or sftp!

bbrian017 07-24-2010 03:58 PM

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

zirias 07-24-2010 04:02 PM

you upload it WHEREEVER YOU WANT, it doesn't matter. As I said, you can delete the file after importing it

bbrian017 07-24-2010 04:16 PM

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

Wim Sturkenboom 07-24-2010 11:38 PM

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

chrism01 07-25-2010 02:27 AM

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.


All times are GMT -5. The time now is 06:33 PM.