如何在php中获取数据库的SQL查询?

时间:2022-06-13 07:26:34

How do I get the query for a dump of an entire MySQL database in PHP? I am planning to then dump it into a .sql file.

如何在PHP中获取整个MySQL数据库转储的查询?我打算然后将其转储到.sql文件中。

2 个解决方案

#1


2  

There is no single "query" (unless the database is structurally simple). What you are asking for is a maintenance operation which is done with the specialized utility mysqldump.

没有单一的“查询”(除非数据库结构简单)。您要求的是使用专用实用程序mysqldump完成的维护操作。

#2


1  

i dont think you can do like a mysql_query("BACKUP NOW"); instead look here:

我不认为你可以像mysql_query(“立即备份”)那样做;而是看这里:

http://davidwalsh.name/backup-mysql-database-php

http://davidwalsh.name/backup-mysql-database-php

http://www.noupe.com/how-tos/10-ways-to-automatically-manually-backup-mysql-database.html

http://www.noupe.com/how-tos/10-ways-to-automatically-manually-backup-mysql-database.html

#1


2  

There is no single "query" (unless the database is structurally simple). What you are asking for is a maintenance operation which is done with the specialized utility mysqldump.

没有单一的“查询”(除非数据库结构简单)。您要求的是使用专用实用程序mysqldump完成的维护操作。

#2


1  

i dont think you can do like a mysql_query("BACKUP NOW"); instead look here:

我不认为你可以像mysql_query(“立即备份”)那样做;而是看这里:

http://davidwalsh.name/backup-mysql-database-php

http://davidwalsh.name/backup-mysql-database-php

http://www.noupe.com/how-tos/10-ways-to-automatically-manually-backup-mysql-database.html

http://www.noupe.com/how-tos/10-ways-to-automatically-manually-backup-mysql-database.html