更改默认Joomla数据库表前缀

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了更改默认Joomla数据库表前缀相关的知识,希望对你有一定的参考价值。

Substitute new_ placeholder in the second line with your new prefix. Run it: http://www.yoursite.com/rename.php and wait until it responds with an OK, usually after a couple of seconds. Delete the rename.php script. Edit the configuration.php file and find the line starting with var $dbprefix. It should look like this: var $dbprefix = 'jos_'; Replace the old jos_ prefix with new prefix, i.e. the one used in the second line of your rename.php script.
  1. <?php
  2. $new_prefix = 'new_';
  3. require_once 'configuration.php';
  4. $config = new JConfig;
  5. $con = mysql_connect($config->host, $config->user, $config->password);
  6. if(!is_resource($con)) die('Error connecting to db');
  7. $test = mysql_select_db($config->db, $con);
  8. if($test===false) die('Error connecting to db');
  9. $prefix = $config->dbprefix;
  10. $sql = "show tables where `Tables_in_{$config->db}` like '{$prefix}%'";
  11. $res = mysql_query($sql);
  12. while($row = mysql_fetch_array($res))
  13. {
  14. $old = $row[0];
  15. $new = $new_prefix . substr($old, 4);
  16. $temp = mysql_query("RENAME TABLE `$old` TO `$new`");
  17. if($temp === false) die(mysql_error());
  18. }
  19. echo "OK";
  20. ?>

以上是关于更改默认Joomla数据库表前缀的主要内容,如果未能解决你的问题,请参考以下文章

在自定义组件中更改 joomla 2.5 默认编辑器

在哪里可以找到 Joomla 内容生成器记录存储表?

将代码添加到 wp-settings.php/更改帖子的表前缀

在 Joomla 2.5 中更改视图布局

如何在 Vs Code 中更改默认自动选择的用户片段行为

如何通过joomla中的组件更改模板位置的内容