Solved

Moving mysql datadir to dropbox, tables in databases not showing

Posted on 2014-02-10
14
1,004 Views
Last Modified: 2014-02-14
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!
0
Comment
Question by:peps03
  • 7
  • 7
14 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
Comment Utility
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.
0
 

Author Comment

by:peps03
Comment Utility
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!
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
Comment Utility
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.
0
 

Author Comment

by:peps03
Comment Utility
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!
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
Comment Utility
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.
0
 

Author Comment

by:peps03
Comment Utility
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.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
Comment Utility
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/
0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 

Author Comment

by:peps03
Comment Utility
is it possible to use localhost on computer and online database?
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
Comment Utility
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.
0
 

Author Comment

by:peps03
Comment Utility
yes, i have that too,.

what i meant is scripting local, and both local and online database "online".
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
Comment Utility
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.
0
 

Author Comment

by:peps03
Comment Utility
I have a vps.

how do i set a db to accept access from outside?
that seems the best solution..
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
Comment Utility
That would be a server routing/firewall issue.  Since this thread is on topic for using dropbox as a database host, close this question out and open a new thread for accessing your db from the outside.   Make sure to specify if you are using windows or linux and which version.

I can tell you it is best to allow access from an outside url only for testing and not production.

Good Luck
0
 

Author Closing Comment

by:peps03
Comment Utility
Thank you for the help!!!
I'll open a new question.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now