重命名 phpmyadmin 中表名的前缀?

发布于 2024-12-13 20:58:34 字数 94 浏览 5 评论 0原文

有没有一种更动态的方法来重命名 phpmyadmin 中数据库中的所有前缀,而不是手动键入来替换每个表的名称?我有大约 50 张桌子需要更改前缀...也许我应该买一块士力架?

Is there a more dynamic way to rename all prefixes in a database within phpmyadmin, rather than manually typing to replace the name for each table? I have about 50 tables to change prefixes on... Maybe I should grab a snickers bar?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

尘曦 2024-12-20 20:58:34

勾选 phpMyadmin 中所有对应的表并选择 With Selected..->Replace table prefix

Have all the corresponding tables in phpMyadmin ticked and select With Selected..->Replace table prefix

白芷 2024-12-20 20:58:34
  1. 单击/打开数据库。

  2. 点击顶部栏的结构
    这将显示您的所有表格。 记下现有前缀

  3. 滚动到底部,到最后一个表格。

  4. 点击“全部检查”
    这将检查所有表格。

  5. 单击旁边的下拉菜单 - 具有默认值“选择”的下拉菜单。

  6. 选择“替换表格前缀:”
    这将带您进入一个包含两个文本输入的新页面。

  7. 填写您现有的前缀,例如“oldPrefi_”。不要忘记下划线。

  8. 填写您的新前缀,例如“newPrefi_”。不要忘记下划线。

  9. 最后,点击提交

您将被重定向到带有新前缀的表列表。

  1. Click/open the database.

  2. Click Structure at the top bar.
    This will display all your tables. Note the existing prefix.

  3. Scroll to the bottom, to the last table.

  4. Click "Check all".
    This will check all tables.

  5. Click the drop down menu just next to it - the one with the default value "with selected".

  6. Select "Replace table prefix:"
    This will bring you to a new page with two text inputs.

  7. Fill in your existing prefix, e.g. "oldPrefi_". Don't forget the underscore.

  8. Fill in your new prefix, e.g. "newPrefi_". Don't forget the underscore.

  9. Finally, click submit.

You will be redirected to the table list with the new prefix.

楠木可依 2024-12-20 20:58:34

一个简单的方法是让脚本为您删除表。在 Joomla 或 WordPress 等大型数据库网站上速度要快得多。

在 phpMyAdmin 中选择自定义输出。在“对象创建选项”下,选中“添加删除表/...”框。照常导出到文本或文件并在首选文本编辑器中打开。您会注意到现在每个表有两行:DROP TABLE IF EXISTS prefix_tablename;CREATE TABLE IF NOT EXISTS prefix_tablename

第 1 步:并将所有“prefix_”替换为“theprefixyouwant_”现在应该如下所示:

DROP TABLE IF EXISTS 'theprefixyouwant_'并且CREATE TABLE IF NOT EXISTS 'theprefixyouwant_'

第 2 步: 搜索所有 DROP TABLE IF EXISTS 'theprefixyouwant_' 并将其替换为
如果存在“prefix_”则删除表

节省。运行/导入 SQL。完毕。

这将在没有提示的情况下删除所有原始表。确保您有安全的数据库备份,以防出现紧急情况。与原始解决方案一样,执行此操作需要您自担风险,但我只是在三个小型生产站点上执行此操作,没有出现任何问题。

An easy way is to let the script delete the tables for you. Much faster on large database sites like Joomla or WordPress.

In phpMyAdmin choose Custom output. Under Object Creation Options, check the box to ADD DROP TABLE / .... Export to text or file as usual and open in preferred text editor. You will notice there are two lines for each table now: DROP TABLE IF EXISTS prefix_tablename; and CREATE TABLE IF NOT EXISTS prefix_tablename

Step 1: Search and replace all 'prefix_' with 'theprefixyouwant_' This should now look like:

DROP TABLE IF EXISTS 'theprefixyouwant_'and CREATE TABLE IF NOT EXISTS 'theprefixyouwant_'

Step 2: Search and replace all DROP TABLE IF EXISTS 'theprefixyouwant_' with
DROP TABLE IF EXISTS 'prefix_'.

Save. Run / import SQL. Done.

This WILL delete all your original tables without prompting. Make certain you have a safe DB backup on file just in case of emergencies. As with the original solution, do this at your own risk, however I just did it on three small production sites without issue.

清醇 2024-12-20 20:58:34

这是一种方法..很简单,只需从 phpmyadmin 下载 SQL 文件即可。在 Notepad++ 中打开文件。搜索并替换所有前缀(即 etc_ 为 dem_)。然后保存sql文件。更改与数据库通信的 php 代码中的前缀值。然后返回您的数据库,备份它。然后删除所有表并在notepad++中安装刚刚修改的.sql文件。简单的!

Here is one way..It's easy as downloading the SQL file from phpmyadmin. Opening the file in Notepad++. Search and Replace all Prefixes (i.e. etc_ with dem_). Then save the sql file. Change the prefix values within your php code that is communicating with the database. Then go back to your database, back it up. Then delete all the tables and install the .sql file you just modified in notepad++. Easy!

南风几经秋 2024-12-20 20:58:34

检查您想要更改的表格(Shift 单击适用于列表)
滚动到表格底部并打开“选择:”下拉列表并选择“替换表格前缀”
填写“from”和“too”框,然后单击“提交”。

Check the tables you wish to change (shift click works for lists)
Scroll to the bottom of your tables and open the "With Selected:" dropdown and choose "Replace table prefix"
Fill in the from and too box and click submit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文