Because I do often work out of the office I have implemented a provision mechanism with the a local server, so I have a "server" running on my laptop and one on my computer office. All my files are stored on the cloud, so both server technically points to the same folder thus meaning my files are in sync.

I'd like to do the same with my database.

On my laptop I have moved my local directory into the cloud storage, then a symbolic link has been added in the /var/lib/mysql folder to point to the remote location. At the time the configuration started, everything was fine on the laptop because the database was empty and all the data have been add from the laptop.

Now, I created the same symbolic link on the desktop, and the local MySQL can access to the database, but this looks empty. I doubt (and scared) to "import" data as they are there and not sure what could happen on the working instance.

Do you know whether I have missed something?

EDIT: Actually selecting the database, I can see nothing in PHPMyAdmin, but running a SHOW TABLES command a list of my tables are there.

Thanks Andrea

  • Probably a safe way to try this out would be to do a create database on the laptop and see if it turns up on the other side. – Jos Apr 26 '14 at 21:35
  • I believe I found the problem. What I see is just the database structure. In fact I just find out that by default MySQL doesn't use a per table data file but save everything in one big innodb file. I have to change my configuration and make sure that data file are in the same location of the database structure – Andrea Moro Apr 26 '14 at 21:50
  • Ok, even though I have moved into an InnoDB structure I continue to experience the same problem. – Andrea Moro Apr 26 '14 at 22:37
  • You can also take a look at Replication – chesedo Apr 29 '14 at 6:56

Ok, I confirm this is possible.

Though I may find professional DBA yelling me for this for no locking is potentially in place, I am still happy with this solution as I'm the solo worker on one computer at a time.

That said, the steps that I used to make this was:

  1. Convert both the laptop and desktop database in INNODB type. This involves backup, master innodb file deletion and a full restore of the previously backed up tables.

  2. Change my.cnf file to make sure everything is complying with the new format

  3. Forcing the database engine table change

As a final precaution as I read that "moving" files location in InnoDb it may be not that simple as part of the structure resides on the local master innodbfile, I converted my database in MyISAM.

At that point, simply creating a symbolic link to the common folder allowed me to see the database on both computers using the cloud as a repository.

Enjoy it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.