[wp-trac] [WordPress Trac] #44925: Installation failure as WordPress cannot connect to MySQL database

WordPress Trac noreply at wordpress.org
Mon Sep 10 11:10:03 UTC 2018


#44925: Installation failure as WordPress cannot connect to MySQL database
----------------------------+-----------------------------
 Reporter:  ededu           |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Bootstrap/Load  |    Version:  4.9.8
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 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
 <?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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44925>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list