开发者

Drupal Installation PDOException

开发者 https://www.devze.com 2023-04-08 22:47 出处:网络
http://localhostgot 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 = :nam

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' => '',
    ),
  )开发者_如何学Go,
);

What to do?


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!


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.


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;


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 :(


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;
0

精彩评论

暂无评论...
验证码 换一张
取 消