Merge two databases with the missing contents - mysql

I have recently migrated one website to a new linux server. But we imported the database of the website was 7days old the actual thing. Now 4 days gone after the migration. So these 4 days database updates which was wriiten to the new server that contains the contents of old server database. We just forget about the 7days database updates from the old server at the time of dns change.
But now our website is having a big issue because they didnt have the missing 7 days database contents. if we imported old database from old server to new server then our latest 4 days database updates on new server will go. Iam in the middle of this.
Can you please suggest a better way to merge these databases into one without any issues or overwritten, so that we can update the same to new server then only the site will run fine. In short we need to merge two databases with the missing contents and site should work fine also. Help me please.

This is going to depend a lot on your data structure (how many auto_increment fields you have, foreign keys, etc.). You will need to dump out everything that was added to the database after the export but prior to the migration, then find a way to import each record.
What is stored in the database?

Related

Is there a way to backup Data from a cpanel database to import it on a localhost database?

Well, I'm doing a website for a company, and I'm working on different steps, lets's say, first I upload some part of the functional website while I work on future sections.
The thing is that I'm creating more tables and columns on the localhost database.
What I need to do is to copy all the Data from the cPanel phpMyAdmin Database, insert it into the new DB, and then re-upload the new Database on that server without losing the information.
This is because every time I upload the Database to the Hosting it resets the values of the tables.
I don't know how not to lose that information, thanks for reading, and sorry if you don't understand something but I'm not an English native speaker.
(I'm using MySQL for the Database Management).

merge design of mysql between localhost and server?

I'm kinda new to this kind of problem. I'm developing a web-app and changing DB design trying to improve it and add new tables.
well since we had not published the app since some days ago,
what I would do was to dump all the tables in server and import my local version but now we've passed the version 1 and users are starting to use it.
so I can't dump the server, but I still would need to update design of server DB when I want to publish a new version. What are the best practices here?
I like to know how I can manage differences between local and server in mysql?
I need to preserve data in server and just change the design, data on local DB are only for test.
Before this all my other apps were small and I would change a single table or column but I can't keep track of all changes now, since I might revert many of them later and managing all team members on this is impossible.
Assuming you are not using a framework that provides a migration tool for database, you need to keep track of the changes manually.
Create a folder sql_upgrades (or whatever name you name) in your code repository
Whenever a team member updates the SQL schema, he creates a file in this folder with the corresponding ALTER statements, and possibly UPDATE, CREATE TABLE etc. So basically the file contains all the statements used to update the dev database.
Name the files so that it's easy to manage, and that statements for the same feature are grouped together. I suggest something like YYYYMMDD-description.sql, e.g. 20150825-queries-for-feature-foobar.sql
When you push to production, execute the files to upgrade you SQL schema in production. Only execute the files that have been created since your last deployment, and execute them in the order they have been created.
Should you need to rollback a file, check the queries it contains, and write queries to undo what was done (drop added columns, re-create dropped columns, etc.). Note that this is "non-trivial", as many changes cannot be rolled back fully (e.g. you can recreate a dropped column, but you will have lost the data inside).
Many web frameworks (such as Ruby of Rails) have tools that will do exactly that process for you. They usually work together with the ORM provided by the framework. Keeping track of the changes manually in SQL works just as well.

Big problems with shared SugarCRM database

Here is my situation:
I have two hosting sites with a domain each, each with Sugarcrm infrastructure. I started with one hosting site and started creating a database through Sugar. Then, I started a SECOND hosting site with a new domain, and I believe I have linked the two databases accidentally. If I change a value in the database on one site, it gets reflected on the other.
So, the original domain/hosting site is expiring, and I would like to move the SQL database over to the new site permanently. I have made a backup of the database from the original site and have it on my desktop.
My questions:
1. Can I just drag the SQL file into the new site (I use FileZilla) database location and everything will be OK?
2. I cannot find the location in file manager of the new site where I would drag this database into!? I use goddady, and the newer site uses cpanel.
**Other problem: I have accidentally upgraded the newer sites SugarCrm version, and have created huge problems because the original site is not upgraded, and the sites do not like that very much as the database is shared. There original site is unreachable (it says you cannot use the newer version database with the old Sugar version), and the new site has visible problems but is workable.
As you can tell, I am a totally inexperienced n00b, and am learning as I go. I have spent weeks setting up this database, and would appreciate any help on maintaining its integrity.
Thank you very much!
Tom
I'm assuming you're using MySQL for your database.
Unless your tables are all MyISAM tables, simply copying the database files won't work.
Whenever you want to move a MySQL database it's a good idea to dump the database, move that file over, then recreate the database. Read up on the mysqldump command.
If you're using Oracle or something else, I would think a similar technique would be desirable. Basically dump your database to a backup format that your database server can use to recreate your database. Don't just copy database files around.

how do i automatically backup mysql database from remote center using the internet to another database

hi i am a beginner application developer , on my new job i have been commission to design
an architecture that will allow me automatically back up data off MySQL databases from 3 different geographical distant centers using the internet to a central database, can anybody please point me the right direction and if it is possible to solve such as problem programmatically.Thank you
If you just want to backup the actual data, a combination of mysqldump, gzip, and scp will move a backup of the database to a remote location. Or you can use database replication.
If what you want to do is merge the data from 3 sources into another database, thats an entirely different problem from backing up.
Have them each backup locally, then download them using ftp or something.
For merging you need to restore then each to there own db,
Then create an empty schema with the same table structure. Each table gets an additional Field for "SourceSystem"
then Load each DB in the Central DB then while updating the "SourceSystem" field. The "SourceSystem" + the original Pk become the new Pk.

MySQL database up, but some tables not updating

I have a mysql db with 10 tables. Each table drives a website where users can look at or submit data to that table.
Now the more popular tables have stopped displaying new data (checking through phpmyadmin).
The smaller tables are still working fine.
I don't get any errors when submitting. The data just doesn't show up in the database.
It's all on one shared hosting server. How can it be that only certain tables in a database have problems?
This kind of question comes up from time to time. Every time I've seen this type of question, it turns out that the app displaying the data is connecting to a different database than the one you're updating through phpMyAdmin.
So my recommendation is to assume nothing, and double-check every database connection in both your apps and your phpMyAdmin sessions.
Try to insert data with phpmyadmin in those tables were you have problems.
I have occasionally had trouble with MySQL not updating tables if I have multiple server processes running using the same data files.
I had these problems with MySQL 4.1 where one server was running standalone and the other was running embedded. MySQL did not generate any error messages on start-up. I have not tried to reproduce my problems with newer versions of MySQL.