Created
October 21, 2008 15:40
-
-
Save carlisia/18330 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[11:18] | |
carlisia | |
does anyone here know how i can transfer data from my local db to my production db? | |
zapnap | |
if the database itself is different (sqlite vs mysql for instance) you will have to do a bit of data conversion to do so | |
[11:21] | |
carlisia | |
with a visual tool (GUI) i know how that can be done. i haven't tried, could i hook up my mysql GUI tool to my db on linode? i can't see why not, but just checking | |
[11:22] | |
SuttoL | |
carlisia: if you have a user which can access it, yes | |
[11:22] | |
SuttoL | |
that is, a user in mysql on the server that isn't restricted to localhost | |
[11:23] | |
carlisia | |
cool. so it's not complicated | |
[11:23] | |
carlisia | |
ah | |
[11:24] | |
SuttoL | |
other option is ssh tunneling, which *can* be complicated | |
[11:24] | |
SuttoL | |
are you using the same database type for each one? (production and development) | |
[11:24] | |
carlisia | |
same, mysql | |
[11:24] | |
SuttoL | |
k | |
[11:24] | |
SuttoL | |
you should be able to do this on your server: | |
[11:24] | |
carlisia | |
i can ssh, but importing the dava via ssh... no clue | |
[11:25] | |
SuttoL | |
mysqldump <databasename> -u<dbusername> -p > ~/data.sql | |
[11:25] | |
SuttoL | |
replacing the parts at the <> | |
[11:25] | |
SuttoL | |
then, download the data.sql file | |
[11:25] | |
SuttoL | |
so, example of the above file: | |
[11:25] | |
SuttoL | |
command* | |
[11:26] | |
SuttoL | |
mysqldump ninjas_production -uninjas -p > ~/data.sql | |
[11:26] | |
SuttoL | |
which will ask for a username, then dump to ~/data.sql | |
[11:26] | |
SuttoL | |
once you've got that downloaded locally | |
[11:26] | |
SuttoL | |
you can run: | |
[11:26] | |
SuttoL | |
mysql <local db name> -u<username> -p < data.sql | |
[11:27] | |
SuttoL | |
where data.sql is the location of the download file | |
[11:27] | |
SuttoL | |
so, e.g. | |
[11:27] | |
SuttoL | |
mysql ninjas_development -uninja -p < data.sql | |
[11:27] | |
carlisia | |
um k.. | |
[11:27] | |
carlisia | |
how do i get data.sql on my server? | |
[11:28] | |
carlisia | |
I suppose this: | |
[11:28] | |
SuttoL | |
like, to download it? | |
[11:28] | |
carlisia | |
mysqldump <databasename> -u<dbusername> -p > ~/data.sql | |
[11:28] | |
SuttoL | |
oh, to make it | |
[11:28] | |
carlisia | |
needs to be run where the source data resides? | |
[11:28] | |
SuttoL | |
yeh, that one will make the file ~/data.sql on the server | |
[11:28] | |
SuttoL | |
nope | |
[11:28] | |
SuttoL | |
can be run anywhere :) | |
[11:28] | |
carlisia | |
it will just create an empty file? | |
[11:29] | |
SuttoL | |
nope | |
[11:29] | |
SuttoL | |
oh | |
[11:29] | |
SuttoL | |
lol | |
[11:29] | |
carlisia | |
yeah... | |
[11:29] | |
carlisia | |
:) | |
[11:29] | |
SuttoL | |
sorry | |
[11:29] | |
SuttoL | |
I'm an idiot | |
[11:29] | |
carlisia | |
the data is in my local computer | |
[11:29] | |
SuttoL | |
the mysqldump one should be run on your computer | |
[11:29] | |
SuttoL | |
then you upload the file it makes to the server | |
[11:29] | |
SuttoL | |
then, you run the other on the server | |
[11:29] | |
carlisia | |
ah si senor | |
[11:30] | |
SuttoL | |
sorry, I'm going crazy | |
[11:30] | |
carlisia | |
we all are | |
[11:30] | |
SuttoL | |
the rumbles not over for me yet :P | |
[11:30] | |
carlisia | |
is there a file upload feature on linode dashboard? should i use that? | |
[11:30] | |
carlisia | |
:) | |
[11:30] | |
SuttoL | |
carlisia: nope | |
[11:30] | |
SuttoL | |
what OS are you on? | |
[11:30] | |
carlisia | |
mac | |
[11:30] | |
SuttoL | |
(your home computer that is) | |
[11:30] | |
SuttoL | |
k | |
[11:30] | |
SuttoL | |
try this: | |
[11:30] | |
carlisia | |
leopard | |
[11:31] | |
carlisia | |
u're awesome! thank u | |
[11:31] | |
→ ivanvr1 | |
joined the channel | |
[11:31] | |
SuttoL | |
scp ~/data.sql user@server:~/data.sql | |
[11:31] | |
SuttoL | |
where user is your server username, server is the address of the server | |
[11:31] | |
carlisia | |
got it | |
[11:31] | |
carlisia | |
super | |
[11:31] | |
carlisia | |
one last question | |
[11:31] | |
SuttoL | |
scp is a life saver :) | |
[11:31] | |
SuttoL | |
shoot :) | |
[11:32] | |
carlisia | |
i suppose that will dump the data from all the tables in the specified db onto the target db. is there a way to make it so it's just one specific table? | |
[11:33] | |
SuttoL | |
not sure | |
[11:34] | |
carlisia | |
np | |
[11:34] | |
carlisia | |
i'll look that up. | |
[11:34] | |
carlisia | |
thank u a million | |
[11:49] | |
carlisia | |
jschoolc just one question, if you know: is it possible to dump only one table from a db? | |
[11:51] | |
guitsaru | |
carlisia: mysqldump [options] db_name [tables] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment