andkirby/mage-db-helper

数据库助手(Magento)

v2.0.0 2017-05-12 12:06 UTC

This package is auto-updated.

Last update: 2024-09-20 01:19:01 UTC


README

概述

这里有一些数据库过程/函数来帮助处理Magento数据库。

Composer安装

$ composer global require andkirby/mage-db-helper

如果你不打算全局使用此安装,可以省略global参数。

安装脚本

$ mage-db-helper install -d dbname -u dbuser -p password1

如果省略了参数--mysql-password (-p)(MySQL密码),你可以通过对话框设置它以确保命令的安全性。你也可以使用参数--no-password (-o)来跳过密码提示;

更多

要获取有关参数的完整帮助,请使用标准的--help (-h)参数。

$ mage-db-helper install -h

在数据库中使用助手

可用的助手

  • DropAllTables,
  • ResetBaseUrl.
  • ResetAdmin.

DropAllTables

从数据库中删除所有表。这在防止重新安装现有过程(如这些过程)时很有用。

CALL dbname.DropAllTables();

ResetBaseUrl

core_config表中重置基本URL。当你迁移数据库时很有用。

CALL dbname.ResetBaseUrl('old-server.example.com', 'new-one.example.com');

ResetAdmin

admin_user表中重置密码、用户名(设置为admin)和第一个管理员用户(ID #1)的锁定。这可以快速重置管理员用户。

CALL dbname.ResetAdmin('your-new-password');

注意:在运行use dbname;之前,示例中可以省略dbname