magento数据库连接
我想在本地主机上进行 magento 数据库备份
,因为我已经编写了以下 php 文件,但无法获得 magento 连接
<?php // magento database connection
$conn=mysql_connect("host","username","password") or die("sorry to connect".mysql_error());
$db = mysql_select_db("db_name",$conn) or die('db error');
?>
<?php
//this is a reference query for export data in csv
$query = "SELECT * INTO OUTFILE 'C:/wamp/www/magento/catalog_product_entity.csv' FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n' FROM catalog_product_entity";
echo $query;
$rs = mysql_query($query,$conn);
$data = mysql_affected_rows($rs);
echo $data;
?>
将数据导入文件“catalog_product_entity.csv”加载到表 table_name 中 以“;”结尾的字段由“”包围 以 '\n' 结尾的行; ?>
回答我的询问。 都给我另一个解决方案。
i want to take magento database backup on localhost
for that i have write following php file but can't got magento connection
<?php // magento database connection
$conn=mysql_connect("host","username","password") or die("sorry to connect".mysql_error());
$db = mysql_select_db("db_name",$conn) or die('db error');
?>
<?php
//this is a reference query for export data in csv
$query = "SELECT * INTO OUTFILE 'C:/wamp/www/magento/catalog_product_entity.csv' FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n' FROM catalog_product_entity";
echo $query;
$rs = mysql_query($query,$conn);
$data = mysql_affected_rows($rs);
echo $data;
?>
LOAD DATA INFILE 'catalog_product_entity.csv' INTO TABLE table_name
FIELDS TERMINATED BY ';' ENCLOSED BY '"'
LINES TERMINATED BY '\n';
?>
answer my query.
all give me another solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
已经有用于此任务的 Magento 模块:
http:// www.magentocommerce.com/magento-connect/centerax/extension/2927/automatic-db-backups
There are already Magento modules for this task:
http://www.magentocommerce.com/magento-connect/centerax/extension/2927/automatic-db-backups
Magento 有一个内置的数据库备份实用程序,默认情况下,可以通过转到“系统”>“数据库备份”来触发该实用程序。工具> Magento 管理中的备份。与其重写此功能,不如简单地找到其中使用的类/方法并简单地调用它会更有效。
Magento has a built in database backup utility, which, by default, can be triggered by going to System > Tools > Backups in the Magento Admin. Rather than rewriting this functionality, it would be much more efficient to simply locate the class/method used there and simply call that instead.