Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upload and Overwrite a MySql db -

Status
Not open for further replies.

letsGo123

Programmer
Jun 8, 2004
10
US
we have a master mysql db locally where we update, delete, insert, etc. we want to use the same db remotely at a handful of different sites on different hosts, etc.

questions is: is there a way that the local master db can be uploaded to 6 different servers, each time replacing, overwriting, etc the existing tables ?

best.
 
I don't know if you can do this for all 6 different servers at the same time, but you can do this for each server separately:

the command is mysqldump

so if I'm using root on my machine, I'd go to the shell and type the following:
mysqldump -u root --databases databasename | mysql -u user -p --host=host.com -C databasename



[cheers]
Cheers!
Laura
 
laura,

thansk for your reply.

i've tried:
Code:
mysqldump -u root db > mysql -u my-username -p --host=my-site.com.com -C database-name_db

and get the following after i enter the correct p-word:
Code:
ERROR 1045: Access denied for user: 'username@my-ip-number.net' (Using password: YES)

any ideas ?

best.

 
Another idea:

If the slave server databases do not get updated locally, then you could use Replication, whereby the slaves automatically keep themselves up-to-date by using the master's binary update logs. It's explained in the MySQL manual.


-----
ALTER world DROP injustice, ADD peace;
 
the only thing I can think of is that perhaps the mysql id and password is different than your system id and password... this happened to me with my host, and I was baffled! My host *forgot* to tell me that the id's and passwords were completely different...

All the best!

[cheers]
Cheers!
Laura
 
thanks for the help.

sorted out the upload issue. but now getting:

Code:
ERROR 1050 at line 1: Table 'products' already exists

i thought that a backup file will try to drop a table before the restore.

what's the gig ?

best.
 
letsGo123 - can u show us the code? I might be able to help, and as I'm looking for help on my own issue, I'll be checking back regularly today...

[cheers]
Cheers!
Laura
 
letsgo123,

Regarding the password problem, make sure that the DB permissions on the host include "my-username@my-ip" or "my-username@%" and not just "my-username@localhost". Log in locally as root and run "select user,host from mysql.user where user='my-username';" to see what's in there.

To answer your first question, it would probably work. I've manually copied new versions of a database from one server to another on occasion, usually to get a current copy of data to a test system, and it works OK.
 
laura -
i was missing the --opt command which will input the following:
Code:
DROP TABLE IF EXISTS products;
CREATE TABLE products (
...
...
)

the statement i used is:
Code:
mysqldump --opt db > backup-file.sql

lgarner -
thanks. i'll check that out.

best.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top