将 MySQL 连接到 Dropbox
我已成功更改我的 httpd.conf 文件,以便将 DocumentRoot 修改为我的 Dropbox 文件夹。 localhost 不再指向 /etc/www,而是 /home/Dropbox/www...
这很方便,因为无论我在哪台计算机上,对我的 Web 文件的更改都会同步,并且 Dropbox 保持透明的版本控制系统在后台。
我想知道是否也可以将 mySQL 数据(不一定是实际的二进制文件)存储在我的 Dropbox 文件夹中。如果可能的话,数据同步将同样有用。人们需要进行什么样的更改才能将数据库、表格和其他用户生成的内容推送到 Dropbox 文件夹,而不是我的本地硬盘驱动器?
I've successfully made changes to my httpd.conf file in order to modify the DocumentRoot to my Dropbox folder. No longer does localhost point to /etc/www, but rather /home/Dropbox/www...
This is convenient because no matter which computer I'm on, the changes to my web files are synchronized, and Dropbox keeps a transparent versioning system in the background.
I'm wondering if it is also possible to store mySQL data (not necessarily the actual binaries) in my Dropbox folder. Data synchronization would be equivalently useful if this were possible. What kind of changes would one make to have databases, tables, and other user generated content pushed off to a Dropbox folder, rather than my local hard drive?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用远程 mysql 数据库可能更容易、更可靠。大多数网络主机都提供 mysql 服务,有些甚至是免费的。同步 mysql 数据库是一件痛苦的事,无论你怎么做!如果您开始复制数据文件本身,它只是在等待损坏!
It is probably easier, and more reliable, to use a remote mysql database. Most web hosts offer mysql services, some even are free. Syncing mysql databases is a pain, no matter how you do it! If you start copying the data files themselves it is just waiting for corruption!
如果您成功复制 MySQL 的数据文件夹并将其指向那里,这是可能的,但是您可能会遇到并发问题。这不是推荐的方法。为什么不使用版本控制系统,例如 svn、git 以及允许远程连接的 MySQL 服务器呢?
数据库更新非常频繁,Dropbox 会强制其更新过于频繁,但有时会无法同步,并且 DropBox 更新会浪费您的连接。这确实不是一个好的做法。
It is possible if you successfully can copy data folder of MySQL and point it to right there however you may encounter problems with the concurrency. That's not a recommended way. Why don't you use a version control system such as
svn
,git
with a remote connections allowed MySQL server?Databases get updated very frequently and dropbox will force it to update too frequently, but it will fail to sync sometimes and your connection will be wasted with DropBox updates. That's really not a good practice.
当然可以,编辑
my.cnf
文件并将datadir
从原来的位置(可能是/var/lib/mysql/
)更改为 <代码>/home/Dropbox/mysql...Sure you can, edit your
my.cnf
file and changedatadir
from what is was (perhaps/var/lib/mysql/
) to/home/Dropbox/mysql...
Dropbox 无法处理文件所有权(和权限),因此如果您的原始数据库文件由 mysql:mysql 所有,则每次同步后所有者将是 youruser:yourgroup,权限设置为 664 并且数据库对于 mysql 将是只读的!
解决方案是将用户 mysql 添加到组 yourgroup 中,然后它以 664 权限工作,并且您不必每次都手动将所有权更改回 mysql。
Dropbox cannot handle file ownerships (and permissions), so if your original database file was owned by mysql:mysql, after every sync the owner would be youruser:yourgroup, the permissions set to 664 and the database would be read-only for mysql!
The solution is to add the user mysql to the group yourgroup, and then it works with 664 permissions and you don't have to manually change the ownerships back to mysql every time.