Drupal 安装 PDOException

发布于 2024-12-07 03:06:19 字数 666 浏览 0 评论 0原文

http://localhost 遇到问题:

PDOException:SQLSTATE[42S02]:未找到基表或视图:1146 表“drupal_test.semaphore”不存在:SELECT 过期,值来自 {semaphore} WHERE name = :name; lock_may_be_available() 中的数组( [:name] => variable_init )(/var/www/drupal/includes/lock.inc 第 165 行)。

这是我的数据库配置:

$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'drupal_test',
      'username' => 'root',
      'password' => 'XXX',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

该怎么办?

http://localhost got problem:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal_test.semaphore' doesn't exist: SELECT expire, value FROM {semaphore} WHERE name = :name; Array ( [:name] => variable_init ) in lock_may_be_available() (line 165 of /var/www/drupal/includes/lock.inc).

This is my database configuration:

$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'drupal_test',
      'username' => 'root',
      'password' => 'XXX',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

What to do?

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

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

发布评论

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

评论(5

歌枕肩 2024-12-14 03:06:19

这件事刚刚发生在我身上。我手动将数据库信息添加到settings.php,并尝试通过访问http://localhost/mysubdirectory来运行安装脚本,而不是通过安装脚本添加数据库信息。 Drupal看到数据库信息并认为它已安装,因此它查找其Drupal表,找不到它们,并抛出错误。

对我来说,解决方案就是手动运行脚本(导航到http://localhost/mysubdirectory/install.php)。希望这有帮助!

This just happened to me. I manually added database information to settings.php and tried to run the install script by accessing http://localhost/mysubdirectory, instead of adding db info through the install script. Drupal saw the db information and thought it was installed, so it looked for its Drupal tables, couldn't find them, and threw the error.

The solution for me was simply to run the script manually (navigating to http://localhost/mysubdirectory/install.php). Hope this helps!

℉服软 2024-12-14 03:06:19

很多时候,只需卸载并重试即可修复此类错误。安装可能有问题,也许您提供了一些不正确的信息。

a lot of times simply uninstalling and trying again can fix bugs like this. It's possible that there was something wrong with the installation of maybe you gave it some incorrect information.

情域 2024-12-14 03:06:19

semaphore 是用于保存信号量、锁、标志等的核心表,这些信号量、锁、标志等不能存储为 Drupal 变量,因为它们不能被缓存。在某些版本更新(6.xx-6.yy)中它丢失了,所以只需创建它:

CREATE TABLE IF NOT EXISTS `semaphore` (
  `name` varchar(255) NOT NULL DEFAULT '',
  `value` varchar(255) NOT NULL DEFAULT '',
  `expire` double NOT NULL,
  PRIMARY KEY (`name`),
  KEY `expire` (`expire`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

semaphore is core table for holding semaphores, locks, flags, etc. that cannot be stored as Drupal variables since they must not be cached. In some version updating (6.xx-6.yy) it was lost, so just create it:

CREATE TABLE IF NOT EXISTS `semaphore` (
  `name` varchar(255) NOT NULL DEFAULT '',
  `value` varchar(255) NOT NULL DEFAULT '',
  `expire` double NOT NULL,
  PRIMARY KEY (`name`),
  KEY `expire` (`expire`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
莫多说 2024-12-14 03:06:19

它尝试读取表但未找到。

如果安装新模块,请尝试重新安装该模块,或将其删除。但如果你不安装任何东西,你需要重新安装所有drupal:(

It try to read a table was not found.

If you install a new module, try to reinstall this module, or remove it . But if you don't install anything, you need to reinstall all drupal :(

流心雨 2024-12-14 03:06:19

这个问题和你的mysql数据库类型有关。如果您要将站点移至另一台服务器,则可能您的数据库类型不匹配并且使用 InnoDB。因此,您必须使用此命令更改数据库表的类型。

ALTER TABLE **table_name** ENGINE = MyISAM;

This problem is related to your mysql database type. If you are moving your site another server, probably your database type is mismatch and using InnoDB. Because of that, you have to change your database table's type with this command.

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