Please do not close this question, it’s not a duplicate and the suggested link explaining how to use quotes on MySQL does nothing for me since this problem is inside a WP script. Thanks
I’m trying to install WP 5.4.1 on a clean Windows 2019 Server virtual machine.
I didn’t use Microsoft Web Platform Installer
since it download old versions of WP / MySQL and PHP, so I’m trying to install from scratch.
Here are the steps I’ve taken:
- Downloaded and Installed latest
PHP 7.4.5
, non thread safe version
and installed it - renamed
php.ini-production
tophp.ini
-
Edited php.ini to:
- upload_max_filesize = 64M
- post_max_size = 64M
- max_execution_time = 300
- extesion=mysqli (removed the semicolon here since PHP needs this driver to connect to MySQL8)
-
In IIS I created the *.php mapping and added default.php and index.php
-
Created the dummy
phpinfo.php
file and tested on IIS, all working correctly and phpinfo() shows data -
Downloaded
MySQL 8.0.20
and installed with the following options:- Server only
- Standalone
- Server computer
- For the authentication method I choose ‘Use Stron password encryption’ as suggested by the PHP installer
-
added MySQL BIN folder to
path
environment variable -
opened
%PROGRAMDATA%MySQLMySQL Server 8.0my.ini
and disabled sha2 and enable native_password:- ;default_authentication_plugin=caching_sha2_password
- default_authentication_plugin=mysql_native_password
-
created a new database for WP, called
wp1
(in MySQL 8, the ‘one liner’ to create the user and grant access at the same time doesn’t work, so we need to do it in 2 lines)
mysql -u root -p
create database wp1;
CREATE USER ‘wp1’@’%’ IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON wp1.* TO ‘wp1’@’%’;
FLUSH PRIVILEGES;
EXIT
-
created the folder
C:intepubwwrootwp1
and give full access toIUSR
andUsers
windows groups so WP can write the config files -
In IIS, right click on the
Default Web Site
and click onAdd Application
pointing to the newwp1
folder - navigate to
localhost/wp1
to start WP installation
So after selecting the language and entering the DB info, I get this error
WordPress database error Unknown column ‘wp_’ in ‘field list’ for query SELECT wp_
After hours fighting with this, here’s what I found:
- the error came from the DB, not WP.
- tried with both
wp1
androot
users during the installation - tried with both
localhost
and127.0.0.1
during the installation - the error generates in setup-config.php file, line 315 $wpdb->query(“SELECT $prefix”)
- seems the problem is that what arrives at MySQL is the string select wp_ insted of select ‘wp_’ (note the missing quotes)
- If I go to MySQL and execute select wp_ I get the exact same error
So the issue seems to be related to how MySQL 8.0 is handling quotes in the query it receives from WP installer…
I restored a snapshot just before installing MySQL 8.0.20 and this time, instead of
Use Strong Password Encryption for Authentication
I selected
Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)
but the error is still the same
Before answering, please consider:
- I’m looking to solve the issue, not to start a discussion whatever I should use MySQL 5.x instead of MySQL 8.x
- Yes, the connection to the database is Ok, that’s not the problem, please read all the my post
- Yes, wp-config is being written with the correct values
Even tough I saw many messages with this same error on the WP forum, they normally have no answer, or the answer don’t make any sense (like asking to OP to check the DB credentials and write access to the WP folder), still I posted on the WP forum, but I no answer yet.
Sorry for my poor formatting!
Can anyone please help?
6
Answers
Finally found the issue...
TLDR; edit your
php.ini
and make sure you have both:display_errors = On
error_log = php_errors.log
Setting error_log solves the issue... I guess that when error_log has no value (default configuration), PHP decides to send the error back to the calling program, resulting in the error message
column 'wp_' in 'field list'
during the WP installation.More details here
I just deleted lines 317 to 322 in
wp-adminsetup-config.php
re-ran the setup and it all worked fine.Might not be the right solution but the only thing that worked for me.
This was for WP 5.5.3, previous versions I had no issues downloading and installing
I just deleted lines 317 to 322 in wp-adminsetup-config.php re-ran the setup and it all worked fine.
Might not be the right solution but the only thing that worked for me.
This was for WP 5.5.3, previous versions I had no issues downloading and installing
Same for me on version 5.6.2 when trying to install a second site using the same database so needed new table prefix
None of the above solutions is worked for my case. Because I have already installed Mysql workbench on my windows machine. I stopped the already running mysql server, I have followed the below mentioned steps.
Open command prompt, then navigate to the following path
Then executed the following command
After that I restarted the apache and mysql on xampp server it is working fine.
I found a solution, for me the problem was in php folder (exactly "php.ini" file), so to get the standard settings I just installed windows server 2019 in VMWare then installed "php 7.4" using web platform, then I copied the PHP folder from VMWare "C:Program Files (x86)PHPv7.4" to my PC (windows10), then I download "wordpress5.8.2", and "mysql8.0.1", after installing mysql and creating DB for wordpress(just create DB) and setup the IIS in my windows10, I ran localhost and every thing working good and wordpress installed without any errors.
So try to get the php.ini that installed with web platform and overwrite it on your php folder and run, if it does not work try to copy the whole php folder and try again, I tried this with php 8.0 but have many errors.
This error is possible if WordPress version doesn’t support server’s PHP version.
In my case I recently installed the latest XAMPP with PHP 8.1.1 and had to downgrade PHP to 8.0.14 in order for WordPress 5.8.2/5.8.3 to be installed and work properly.