Export mysql table into SQL format? [closed]

喜欢而已 提交于 2019-11-30 21:21:55

Do not reinvent the wheel. What you need already exists almost out-of-the-box:

<?php
    $result = exec("/path/to/mysqldump -u$username -p$password your_database your_table > /desired/output/path/dump.sql");

You may want to check the contents of $result afterwads, to make sure everything went smooth.

Reference manual here.

You are getting the error because you are using a deprecated function ereg_replace

This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.

I would suggest you to use preg_replace() as alternative to this function.

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