转储匹配表 php [英] dump matching tables php

查看:51
本文介绍了转储匹配表 php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果主题前缀与使用 php 的给定子字符串匹配,我正在尝试转储我的一些表.尝试使用 php 的 system 并没有带来任何结果,因为没有创建转储文件.我想使用命令行函数 exec 来实现我的结果,我做了以下

I'm trying to dump some of my tables if the prefix of theme is matching a given sub string using php. Trying to use php's system did not bring any result in sense the dump file was not created. I thought to use the command line function exec to achieve my result and I was making the following

 exec('E:/xampp/mysql/bin/mysqldump '. $dbname .' -h '. $this->host .' -u ' .$this->user . ' $(E:/xampp/mysql/bin/mysql -u '. $this->user . ' -p ' . $dbname .' -Bse "show tables like \'wp_dev%\'")> mydb.sql 2>&1', $output);

但是子查询会过滤掉匹配表的内容返回以下错误

but to sub query what would filter out the matching tables is returning the following error

mysqldump: unknown option '-s'

似乎我在语法上遗漏了一些东西.

It seems like I'm missing something by the syntax.

推荐答案

这样使用,只会转储列出的表.

Use like this, it will take dump of only listed tables.

exec('E:/xampp/mysql/bin/mysqldump -h '. $this->host .' -u ' .$this->user . ' -p'. $this->password .' '. $dbname .' table1 table2  > /path_to_file/dump_file.sql');

这篇关于转储匹配表 php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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