Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#44925 closed defect (bug) (invalid)

Installation failure as WordPress fails to create database tables

Reported by: ededu's profile ededu Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords:
Focuses: Cc:

Description

The famous 5-min installation fails as WordPress is unable to connect to the database.

Steps:

  1. wget https://wordpress.org/latest.zip
  2. unzip in root folder
  3. edit wp-config.php (preserve defaults for database charset and collation type)
  4. go to to https://example.com/ and I am redirected to ./wp-admin/install.php
  5. fill in form and click on Install WordPress

WordPress database error: [Table 'wordpress.wp_options' doesn't exist]

Doing it over and over again, I also got the error:

ERROR ESTABLISHING A DATABASE CONNECTION
Access denied for '*'@'localhost'

From command line I can successfully connect to the database (same values as in wp-config.php):

mysql -uDB_USER -pDB_PASSWORD -hDB_HOST DB_NAME

With the following script I can successfully connect to the database:

<?php
<?php
$dsn = 'mysql:host=localhost;dbname=wordpress';
$user = '*****';
$password = '******';
try {
  $dbh = new PDO($dsn, $user, $password);
  echo 'PDO database connection successful!<br>';
} catch (PDOException $e) {
  echo 'Connection failed: ' . $e->getMessage() . "<br>";
}
$link = mysqli_connect("localhost", $user, $password, "wordpress"); 
if (!$link) {
  echo "Error: Unable to connect to MySQL.";
}
echo "mysqli connection works.<br>";
echo "Host information: " . mysqli_get_host_info($link);

mysqli_close($link);
?>

Output:

PDO database connection successful!
mysqli connection works.
Host information: Localhost via UNIX socket

ENVIRONMENT:

Server: Apache/2.4.27 (Fedora) PHP/7.1.11 OpenSSL/1.0.2k-fips

Installation fails over both http or https.

Change History (6)

#1 @mukesh27
7 years ago

  • Component changed from Bootstrap/Load to Database

#2 @ededu
7 years ago

  • Summary changed from Installation failure as WordPress cannot connect to MySQL database to Installation failure as WordPress fails to create database tables

It looks like database connection is successfully established because wpdb->db_connect() returns true

Also I see no login error in /var/log/mysqld.log

That means the exception occurs in the context of a valid database connection.

PS: I'm trying to debug this myself but I'm new to both PHP and WordPress. Any help would be much appreciated.

Thanks

Last edited 7 years ago by ededu (previous) (diff)

#3 @knutsp
7 years ago

  • Component changed from Database to Upgrade/Install
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 4.9.8 deleted

Hello and welcome to Trac, @ededu

This place is a tool for tracking bugs and enhancements in the software, not offering support for individual sites. Please use our support forum https://wordpress.org/support/forum/installation/ to get help installing WordPress.

If it turns out to happen because of a bug in WordPress, please come back to this ticket, reopen it and provide exact steps and conditions for anyone to reproduce it.

#4 @ededu
7 years ago

@knutsp
Thanks for reply, I'm not asking for support for my individual site, I'm reporting what looks like a genuine bug in WordPress.

I have already visited the forum and my issue is identical to this one, which remained unsolved:
https://wordpress.org/support/topic/wordpress-install-issues/

If you need any additional information to reproduce the problem, please let me know.

#5 @ededu
7 years ago

Setting pcre.jit=0 fixed the problem.

#6 @netweb
7 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.