简体   繁体   English

跨桌面同步phpMyAdmin DB

[英]Sync phpMyAdmin DB's Across Desktops

So i just setup my Xampp Apache server to load all the documents i create on my Google Drive. 因此,我只需设置Xampp Apache服务器即可加载我在Google云端硬盘上创建的所有文档。 For example if i type 127.0.0.1, it will show me all my web files on my Google Drive. 例如,如果我键入127.0.0.1,它将向我显示我的Google云端硬盘中的所有网络文件。 I set this up so i can develop across my laptop which i use at school and my desktop which i use at home without having to copy files back and forth between computer to computer. 我进行了设置,以便可以在学校使用的笔记本电脑和在家中使用的台式机之间进行开发,而不必在计算机之间来回复制文件。 This works the way i want it to but i forgot one thing. 这以我想要的方式工作,但我忘记了一件事。 How am i supposed to sync my databases that i create. 我应该如何同步我创建的数据库。 My question to you is how can i sync my databases to the cloud or somewhere else so i don't have to export and import every time i switch devices? 我对您的问题是如何将数据库同步到云或其他地方,这样我每次切换设备时都不必导出和导入?

Also i would like to stay away from using hosting as i won't be online all the time. 我也想远离使用托管,因为我不会一直在线。

The database server (the application itself) expects exclusive access to the data files. 数据库服务器(应用程序本身)希望以独占方式访问数据文件。 If you try to synchronize a data file between two systems, you're going to have issues and probably data loss. 如果您尝试在两个系统之间同步数据文件,则会出现问题,并且可能会丢失数据。

What you could do is synchronize the data directory and make sure you're only running one server at a time. 您可以做的是同步数据目录,并确保一次只运行一台服务器。 So when you're done working on the laptop, shut down the MySQL server process/service (mysqld), wait for it to finish synchronizing, and then start up the mysqld on the desktop. 因此,在笔记本电脑上完成工作后,请关闭MySQL服务器进程/服务(mysqld),等待其完成同步,然后在桌面上启动mysqld。 I suspect this will work, but it's a pretty non-standard usage so anything could happen. 我怀疑这会行得通,但这是一种非常不标准的用法,因此任何事情都可能发生。

To make it easier, I'd definitely consider writing a wrapper script/batch file that first tests for the presence of a lock file, then (if non exists) creates one, starts the mysqld, and when exiting make sure mysqld is stopped before deleting the lock file. 为了简化操作,我绝对会考虑编写一个包装器脚本/批处理文件,该文件首先测试锁定文件的存在,然后(如果不存在)创建一个包装器/批处理文件,启动mysqld,并在退出时确保在停止mysqld之前将其停止删除锁定文件。

Anyway, to make this happen you would first stop mysqld everywhere, take the one mysql data directory that you wish to use, copy it to your Google Drive, then edit all of your MySQL configuration files to point to the new data directory instead of the old one. 无论如何,要做到这一点,您首先要在所有地方停止mysqld,将您想要使用的一个mysql数据目录复制到Google Drive中,然后编辑所有MySQL配置文件以指向新的数据目录,而不是旧的。 Whether XAMPP makes this more difficult than it should be, I'm not sure, but with stock MySQL it should be pretty trivial. 我不确定XAMPP是否使此操作比应做的更加困难,但是对于现有的MySQL,这应该是微不足道的。

Remember that just because it's possible doesn't make it a good idea, and likewise that just because it's not a good idea doesn't make it won't work. 记住,仅仅因为可能不是一个好主意,同样,仅仅因为它不是一个好主意也不能使它行不通。 So I'm saying it's not a good idea to do this, but if done with proper attention it will "probably" work. 因此,我说这样做不是一个好主意,但是如果适当注意,它将“可能”起作用。

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM