Link to home
Start Free TrialLog in
Avatar of peps03
peps03

asked on

Moving mysql datadir to dropbox, tables in databases not showing

Hi,

I edited the mysql datadir in the my.cnf configuration file in c:\Xampp\mysql\bin\my.cnf to a different location.

I moved the datadir location to my dropbox folder to have the same databases on multiple computers, but some of the database now have no tables in them, on computer(s) they were not created on (although the folders of the database do contain the database table files).

new datadir="C:/Dropbox/Websites/_databases"

It doesn't matter is the db is innodb or myisam i believe, both types either have all the table showing or none.

What is causing this?
What can i do to make this work? ("syncing the databases through dropbox"?)

Thanks!
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

It sounds like they are not synced.  The first sync takes the longest.  Check the size of the file for each computer.  That should give you a clue if they are synced.  Double check syncing is on for each computer as well.
Avatar of peps03
peps03

ASKER

Thanks for your reply.
Maybe i'm not 'syncing' correctly. I'm just syncing the data directory via dropbox, but it works for some databases, not for others.

I checked a database that works on computer 1, where is was created.
The db folder is also on computer 2, all files and sizes match.
5x .frm and 1x db.opt - files
Which seems correct as well, the db consists of 5 tables.

Only on the second computer the database has no tables, but the database itself is visible.

What to do?
Thanks!
Try throwing another test file in that dropbox folder and see if the other computer is getting it.  

I use dropbox for most of my development but not for a database.  I suppose if you are just using it for developing it would be fine.   If you have an active db in a dropbox and dropbox is continually syncing, I think that is going to end up bad.

Why are you using dropbox for this?  Just throw your db on a cheap shared hosting.  This is only $5 bucks a month https://www.digitalocean.com/pricing.  At one time newtek had $3 hosting just for development http://webservices.thesba.com/linux-web-hosting/ 

I just would not trust a database in something like dropbox or google drive.
Avatar of peps03

ASKER

Yes, it is getting the files transferred.

I don't know if dropbox syncing will be a big problem. 99% of the time only 1 of the computer is on, when syncing, the other will be off.

Is it possible to use an online database (in a hosting package) and local web-server for development?

I have my own vps, but i don't want to work online as the uploading of files will drive me crazy.

And i believe dropbox sync of databases should work, just need to know how.

Is their a way to rebuild the db or something? as the files are there...

thanks!
It would be better if no computers were syncing.  Everytime you update/add/delete from the database or even if the db creates logs, syncing will kick in.  That could be many times per minute.  I don't know enough to give you a firm answer but that does not seem like a good answer.  

If you just want to develop locally, use localhost on your computer or MAMP/WAMP.
Avatar of peps03

ASKER

If you just want to develop locally, use localhost on your computer or MAMP/WAMP...

Yes, i'm using xampp, i think its similar, but i develop on multiple computers.. thats the problem.
I develop everything on dropbox myself.  It is great because it auto syncs with multiple computers plus it is an easy version control (go to dropbox.com and you can view every save of your document you ever did.  If you are on paid it is forever, if free, just 30 days history).

But for my database, I use my server when it is windows/mssql server and for mysql/php, I push out from my local dropbox to my local site where the folder my localhost is located.    I don't have a db on my dropbox drive.  

I also have an external drive for back  up and that gets the stuff dropbox does not.

I have been using the free local version of bitnami http://bitnami.com/
Avatar of peps03

ASKER

is it possible to use localhost on computer and online database?
Yes, that is a common way to develop where the test db is localhost and the live is online.  It should be a matter of switching out your connection string live vs localhost.  I have scripted to detect the domain in my connection string so it automatically uses the live db when online vs the testing db. That avoids the oops of overwriting your connection string file.
Avatar of peps03

ASKER

yes, i have that too,.

what i meant is scripting local, and both local and online database "online".
I am still not sure what you are asking.  Do you mean if you can script locally for the online database like you do with the local?

That will depend on your hosting.  If you are on a shared host, you are at their mercy and the default is typically you can access the db from outside.  If you have a dedicated or vps you can control this.  On my production database, I don't allow connections from the outside and only from localhost(on the server).  It is common practice to have both a testing db that you can access and a production db that you can't connect to from the outside.
Avatar of peps03

ASKER

I have a vps.

how do i set a db to accept access from outside?
that seems the best solution..
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of peps03

ASKER

Thank you for the help!!!
I'll open a new question.