# WP CLI - wp db throwing mysql errors in PHP 8

**URL:** <https://community.localwp.com/t/wp-cli-wp-db-throwing-mysql-errors-in-php-8/33977>\
**Category:** Support\
**Created:** [November 1, 2022, 7:38pm UTC](https://community.localwp.com/t/wp-cli-wp-db-throwing-mysql-errors-in-php-8/33977 "2022-11-01T19:38:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![robruiz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/robruiz/32/10016_2.png) [@robruiz](https://community.localwp.com/u/robruiz)\
**Post date:** [November 1, 2022, 7:38pm UTC](https://community.localwp.com/t/wp-cli-wp-db-throwing-mysql-errors-in-php-8/33977/1 "2022-11-01T19:38:19Z")

</div>

### Issue Summary

Im attempting to use the WP CLI when my local is on PHP 8. It mostly works until I attempt to use “wp db query” commands or anything of the sort where it actually needs to communicate with the db. I think somehow search-replace works though. I get errors like:

“ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)”

I also wrote some custom wp db commands that also dont work. My suspicion is that this is an incompatibility between my local WP CLI version and PHP 8.

I attempted to update the WP CLI, but it wont let me.  
" The ‘cli update’ command has been disabled from the config file."

What config file? How can I change that so I can update it?

Please help.  
Thank you.

#### System Details

- Which version of Local is being used?  
6.4.3

- What Operating System (OS) and OS version is being used?  
macOS Big Sur

---

<div class="post-metadata">

**Author:** ![austinwendt](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/austinwendt/32/13912_2.png) [@austinwendt](https://community.localwp.com/u/austinwendt)\
**Post date:** [November 3, 2022, 6:01pm UTC](https://community.localwp.com/t/wp-cli-wp-db-throwing-mysql-errors-in-php-8/33977/2 "2022-11-03T18:01:58Z")

</div>

Hey @robruiz - long-time no see, hope you’re doing well!

Interesting - I tried this on a site of mine on PHP 8.0.22 (it’s possible you’re on PHP 8.0.0?) and this was my output of `wp db query` - it appears to have worked.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/lwpforums/original/3X/b/e/bebf0240e51e4c86bde714e23fe0fe2ee0408d56.jpeg)

If you have some examples of other commands I can try running, let me know. I’m also on Local v6.5.1.

That said, that’s not what you asked! How to disable that:

1. The config lives in `/Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/config.yaml`
2. If you open the Applications directory and right click on Local, hit “Show Package Contents”
3. Navigate to Contents/Resources/extraResources/bin/wp-cli and open that config
4. Comment out the first couple of lines (it says disabled commands), save, and relaunch Local

To be honest, I thought we had removed that be default so users could do this - I’ll check on why that’s still there. But if you follow those steps, you’ll be able to run that update command again. Sorry for the hassle! We’ll also work on bumping to the updated version.

---

<div class="post-metadata">

**Author:** ![austinwendt](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/austinwendt/32/13912_2.png) [@austinwendt](https://community.localwp.com/u/austinwendt)\
**Post date:** [November 4, 2022, 6:53pm UTC](https://community.localwp.com/t/wp-cli-wp-db-throwing-mysql-errors-in-php-8/33977/3 "2022-11-04T18:53:09Z")

</div>

Update: it _ **shouldn’t** _ still be there, we thought we had gotten rid of that “disabled commands” portion. I’ve made a ticket for the engineering team that’ll take care of that, and `wp cli update` should work in when we get that in a release!

---

<div class="post-metadata">

**Author:** ![robruiz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/robruiz/32/10016_2.png) [@robruiz](https://community.localwp.com/u/robruiz)\
**Post date:** [November 6, 2022, 2:52pm UTC](https://community.localwp.com/t/wp-cli-wp-db-throwing-mysql-errors-in-php-8/33977/4 "2022-11-06T14:52:11Z")

</div>

Thanks for the diligence in looking into that. I will dig into this more this coming week.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)\
**Post date:** [February 4, 2023, 2:52pm UTC](https://community.localwp.com/t/wp-cli-wp-db-throwing-mysql-errors-in-php-8/33977/5 "2023-02-04T14:52:53Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
