Can you use MySQL to connect to a standalone database e.g. “mydata.db”?

荒凉一梦 提交于 2021-01-28 06:50:29

问题


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

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


回答1:


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

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

Here is a Example for SQLLite3:

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

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



来源:https://stackoverflow.com/questions/25610086/can-you-use-mysql-to-connect-to-a-standalone-database-e-g-mydata-db

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!