Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#43167 closed defect (bug) (duplicate)

Unable to install worpress, error on wp-admin/setup-config.php

Reported by: irecinius's profile irecinius Owned by:
Milestone: Priority: normal
Severity: major Version: 5.1
Component: Database Keywords:
Focuses: Cc:

Description

Install Step 2: fails with message
"WordPress database error Unknown column 'wp_' in 'field list' for query SELECT wp_"

MYSQL -> SELECT VERSION();
RESPONSE -> '5.6.38-83.0-log'

Bug:
Setup-Config@L310
https://github.com/WordPress/WordPress/blob/master/wp-admin/setup-config.php#L310

Running the query:
$wpdb->query( "SELECT $prefix" );

MYSQL -> SELECT wp_
RESPONSE -> Error Code: 1054. Unknown column 'wp_' in 'field list'

Observations, query fails regardless if prefix exists or not, tested on a working database, same query fails with same message

Change History (5)

#1 @mikemanzo
7 years ago

Same issue

MySQL (v): 5.7.21
PHP (v): 7.2.3

Error: WordPress database error Unknown column 'wp_' in 'field list' for query SELECT wp_, referer: https://rusticcoders.com/wp-admin/setup-config.php?step=1

#2 @dd32
7 years ago

I feel like there's another ticket for this, however, I'm wondering if the following will both work with the intended purpose of this code and work with modern MySQL/PHP:

$wpdb->query( $wpdb->prepare( "SELECT %s AS $prefix", $prefix ) )

This check is to validate that the database prefix chosen is viable on the MySQL variant unquoted, ie. "Can I query for '{$prefix}posts' or would I need to escape characters in the $prefix for it to work".

#3 @mikemanzo
7 years ago

  • Severity changed from normal to major

#4 @SergeyBiryukov
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi @irecinius, welcome to WordPress Trac!

Thanks for the report, we're already tracking this issue in #42362.

This ticket was mentioned in Slack in #core by desrosj. View the logs.


7 years ago

Note: See TracTickets for help on using tickets.