您可以使用MySQL连接到独立数据库吗?"mydata.db"? [英] Can you use MySQL to connect to a standalone database e.g. "mydata.db"?

查看:56
本文介绍了您可以使用MySQL连接到独立数据库吗?"mydata.db"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以肯定的答案是否",但我没有确定的结果……

Pretty sure the answer is "no" but I have found no conclusive result...

基本上可以使用MySQL连接到独立数据库文件,然后在其上使用标准MySQL命令吗?目前,我使用SQLite3来做到这一点,但现在我喜欢使用MySQL命令,同时保留没有MySQL服务器的单个文件.有可能吗?

Basically, can use MySQL to connect to a standalone database file and then use standard MySQL commands on it? Currently I use SQLite3 to do exactly this but I now like the usage of MySQL commands whilst retaining the single file devoid of a MySQL server. Is it possible?

Ilmiont

推荐答案

对于mysql函数来说是不可能的,但对于 PDO 来说还是可行的.大多数SQL命令都可以在任何基于SQL的RDBMS中使用.

Not possible with mysql function, but still possible with PDO. Most SQL Commands should work in any SQL Based RDBMS.

PDO旨在具有通用接口,因此,即使您拥有MySQL数据库,也应考虑使用 PDO 进行开发.

PDO is meant to have a generic interface, so even if you would have a MySQL Database, you should consider developing in PDO.

以下是SQLLite3的示例:

Here is a Example for SQLLite3:

http://www.if-not-true-then-false.com/2012/php-pdo-sqlite3-example/

如果您想深入了解 PDO ,请阅读此文章:

If you want to get deeper into PDO, read this article:

http://code.tutsplus.com/tutorials/why-you-should-be-using-phps-pdo-for-database-access--net-12059

这篇关于您可以使用MySQL连接到独立数据库吗?"mydata.db"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆