Proper way to backup and restore django project - mysql

I have been using Oracle's virtual box to setup an Ubuntu 18.04LTS OS to run my django application. The application is using MySQL as a database. The problem happened a few days ago, all my files suddenly became read-only, which is an indication of hard disk problems as seen in this post.
I have since prepared another server to run the application, however I would like to know the proper procedures in migrating data to ensure that I don't loose any of my files. Could someone point me in the correct direction? Thank you.

Related

How do I migrate a SQLAnywhere 9 db running in a remote server into a mysql server on my machine?

I am working at a company that has some CRM software running in a remote Windows XP server that uses a SQLAnywhere 9 db to store its data; I have access to this remote server with an administrator account.
I would like to extract the db into a .sql file so that I can run the db locally on my machine without affecting the running db in the server (since it is key for the company's day to day operation).
The reason I need this is that we are going to test some BI Software and we need data from this database to test it, but we don't know the structure of the database since the developers of the CRM software didn't give us any documentation on it. So we need to have the database locally so that, without affecting the running CRM, we can:
understand the structure by looking at the DDL
make queries to it to get sample data
I researched a bit, and the most common solution to my problem was to use dbunload on the remote server to unload the db into a reload.sql file that contained what I needed. But most tutorials on the subject mention that I have to stop the db first (which would be catastrophic). If this is the only option, then I guess I am willing to do it on the weekend when the CRM is not used, but I wanted to know if there was another solution first.
If there is no other solution, can you point me to where I can find the proper and safer way to do this?
I have researched a lot, but prior to this day I have never even heard of SQLAnywhere, so I really need all the help I can get. My main concern is doing something that impacts negatively the CRM software.
Thank you.
You can run dbunload across the network, you just have to tell it to do an "external" unload. The default is to do an internal unload which would only work from the machine where the database server is running.
I don't have SQL Anywhere 9 documentation right now to look up the exact switch, but dbunload -? should show you all the possible switches.
Edit:
-an will create a new database and load the data and schema from another data
-xi switch will do external unload and internal reload.
-c parameters to connect to your remote database

Can't Import Wordpress Database via PHPmyAdmin - Can't Perform Migration Via Plugin

I normally migrate databases for wordpress installs using wp_sync_db plugin. It has never failed before. Now when I'm trying to migrate from my local development server to the live site it's giving the following error.
I've tried only migrating specific fields, but it always runs into an error, just the field will be different.
I've tried to manually import the database to the live site and that is also failing with this error:
I'm not a database expert, and this is really frustrating. I have about two days of work I'm trying to migrate to the live site and can't do it with these errors.
I've been working on trying to solve this issue for a few hours, but have got no where. I've tried deleting the fields mentioned in the error, but that changes nothing. I've tried about 1000 different variations and configurations and it just keeps failing.
Please some database expert step in and save me!
I have no idea about the wp_sync_db plugin, but the phpMyAdmin error comes from having an older version of MySQL on your host which doesn't support the utf8mb4_unicode_ci collation.
You could look for the "Database system or older MySQL server to maximize output compatibility with:" dropdown on the phpMyAdmin export page, then select MYSQL40 there, but you run the risk of losing data if you have multibyte characters stored in your database.
This support page has a good summary of the situation and strongly suggests that you make your local MySQL version match as closely to your hosted version as possible, but that seems like a harsh reality in which to develop. I'm not a WordPress expert, but I believe that if you export for MYSQL40 compatibility and check the resulting imported data for any flaws you should be relatively safe.

Database during release and developing

I am new to Database programming and there is some general questions that I would like to ask. I created the schema in my localhost using mySQL and linked to eclipse. There are some problems that I do not know how to approach.
One of my friends would like to help to develop at his personal machine, but he could not link to my database server. So one way is to copy the schema to his mySQL and change the connection string, are there any better ways?
If I would to release the project and run it on different machines, will it affect the databases operation since the schema resides in my local server.
Is there ways to just like attach the database inside the project since it is a local database and I am not accessing it from any other programs.
Sorry if my questions sound very stupid. I am really new.
Your approach of running local test MySQL instance for every developer sounds fine.
However, if your application never needs any data shared (essentially database is always local as you stated), then you should ask yourself if MySQL really an appropriate solution for your application. I think SQLite is a better choice in that situation - it is likely to work faster than MySQL for local access, and it has essentially zero setup - no database daemon to run or anything like that which greatly simplifies application install.
Granted, SQLite has its limits, but I often use SQLite for my projects, and only if they grow large, I might migrate them to MySQL or PostgreSQL if task requires it.
Typical signs that SQLite may not cut it:
Many clients (10+) need to access database for writing
Total database size is very large - more than 10GB total

Proper way to set two Rails applications on same server

I have two (same) applications running on dev.example.com and beta.example.com with different databases. Everything is set to run with passenger using Apache as web server.
What I have done was to copy the code from one directory to the other (myapp_dev and myapp_beta) and everything seems working fine, until I have to migrate a table. I get an error that the data I want to migrate is already migrated. Probably trying to migrate on the same database. Maybe I have to re-configure the way to run the applications, but don't know how and what to do. Any hints are appreciated.
Thanks!
you can change the used database in config/database.yml

mysql: keeping local mysql database and remote server database synced up

I am kind of a amateur at web development. But it seems like most people develop on their local machines and the upload to their remote servers when everything is ready. I want to start doing this. I've installed Xampp (Apache) on my local machine. But in order for this to really work, i need the the mysql databases that already exist on my remote server to be "synched" or "duplicated" on my local machine. But I'm finding this somewhat hard to figure out.
First, Should I be using mysql "reduplication" feature (with my remote server as master) and local machine as slave? Or is there a better way to do this? Should I be synchronizing instead of reduplicating
Second, Is anyone willing to give me a quick description of how I achieve this "reduplication" or "synchronization"
Thanks
It may be tempting, but it's hopeless to try to keep the database in two places. Instead, always keep the database on the server because it's much easier to develop and debug your code if it's in just one place. "Resynch" and "reduplicate" and all that business is just too much trouble, as you are discovering. The DB is going to end up on the server anyway, so you may as well put it there right now.
Also, you will not need a web server on your local machine, which will unburden you.
This next is applicable if you are writing CGI. If you aren't sure whether or not you are writing CGI, then you are not (well, probably not). {
If you mainain just one database and it lives on your server, you'll be able to write one piece of portable code that will run equally well on your local machine and on your server. This is a huge win, take my word for it.
To get this working, you will need the mysql library on your local machine; no other mysql component is needed there. The mysql server will run on your server only.
Read up on mysql "connector" for the language you're using.
}