Actually, I figured out how to do this, and it’s actually really easy to do! Which is awesome because I think it’s a great simple way to work!
First up, you don’t want to change the PATH for PHP in bash. So you’ll want to remove that. Instead, what you are doing is using bash based PHP and MySQL, but connecting to your Windows MySQL (installed by XAMPP).
Step 1:
sudo apt install mysql-client php-cli php-mysql
Step 2:
Create a symlink in bash to your website files, so something like this:
sudo ln -s /mnt/c/websites /var/www
Step 3:
You need to connect to you MySQL db with an IP address, not localhost. So when creating your config do something like this:
wp config create --dbname=wpdbname --dbuser=wpdbuser --dbpass=securepswd --dbhost=127.0.0.1
If you want more info, I also wrote a blog post about this.
Related Posts:
- Running WP Cron on multisite the right way
- WP-CLI – Selecting PHP version
- WP CLI info showing correct PHP binary but wrong version of PHP
- Utilize WP-CLI from inside WordPress, not SSH
- Setting Up PHPUnit tests for WP development on Windows
- PHPCS: Strings should have translatable content
- Different output from WP-CLI in bash vs PHP exec()
- wp search-replace on database returns PHP fatal error: Array and string offset access syntax with curly braces is no longer supported
- PHP Parse error on WP-CLI, not on web server
- WP-CLi PHP Warning: mysqli_query(): (HY000/1356): View During Search Replace
- call to undefined function mysql_connect
- How come there is no error if I upgrade WordPress core after locking .htaccess permissions to 644?
- Full search and replace isn’t enough to make all pictures to be loaded with https
- Cannot register a custom WP-CLI command
- Run a WP-CLI command from within PHP without using shell_exec()
- Running WP-Cron on Multisite networks the right way?
- Matching a space in regex
- Undefined function mysql_connect()
- How can I call WordPress core functions in external scripts?
- How do you code for WordPress?
- Conditional Statement – check if post has an attachment image
- WooCommerce – Customer Order History Pagination
- Change dns-prefetch to preconnect with correct protocol
- submit the form to same page
- How to set status codes such as 401 and 403?
- Minify HTML, CSS, JS with PHPWee?
- Show Custom Taxonomy Title
- How do themes render caption texts in extended markup (e.g. “wp-caption” paragraphs)
- WordPress widget/sidebar dividers?
- Add custom php database code above
- PHP code inside shortcodes
- Latest post in a specific menu
- WordPress not reflecting changed of the database
- Reload part of checkout on changed shipping method
- how to combine wordpress htaccess on my root domain + php on subfolder
- Input data from email form not going to JSON file
- custom css for admin only
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- Hide a div when tags doesnt exist [duplicate]
- Multiple meta_key in one global $wpdb;
- What does -> mean in WordPress?
- Parsing Menu Items and Blog Posts
- First Byte Time (back-end processing)
- How to update and save user metadata on page visits?
- How to optimize update_post_meta?
- Contact Form 7 – Replace database configured form template with a static file
- HTML Special Characters in URL string [closed]
- How to pass argument to add_action while the method is inside a class?
- Generate CSV file and add data as a new wordpress custom post
- Getting taxonomy category Image from ACF [closed]
- Add URL parameter to all internal links using a specific theme
- How can I use a text and a function php
- Warning: call_user_func() expects parameter 1 to be a valid callback, function
- Call featured image url
- How to make changes to style.php [closed]
- select wordpress custom post type
- Unserialize Custom Field & Save as Multiple Rows in WordPress Database
- Modify WooCommerce used to get all orders in dashboard
- Add a product category to a specific product via a button
- WordPress can’t use ZipArchive
- Adding an Anchor Link to a wordpress menu using WPBakery Page Builder
- WordPress SQL Prepare
- WordPress loading progess – wp-blog-header.php
- How to hardcode header and footer in WP?
- Creating a checklist with ACF and I cannot figure out how to add all iterations to an array that I’m creating
- Trying to generate a CSS file in wordpress uploads folder
- What is wrong with this piece of PHP code? This is for an email template. (I am completely new to PHP)
- register_setting not save checkbox
- Add Product Permalink in woocommerce admin order page
- Proper use of Output Buffer for a whole php clas
- get_template_part() not working with Advanced Custom Fields plugin
- List all ACF field values across every post on one page
- Closing Comments conditionally in comments.php
- How do I make comment-reply-button with that takes to comment reply form on click
- Allow user to choose header style
- Require advice handling a URL redirect from a Third Party. URL Params need to populate and then forward to payment
- ERR_TOO_MANY_REDIRECTS / To Force SSL Logins and SSL Admin Access
- Not able to add new item in wordpress home page
- html to posts, jpg to featured image, zip file contains jpg and html
- views How to load javascript on custom page template?
- Two theme locations for two menus, but only one is showing up
- How to find the function which is outputting Array
- Contact form field in wordpress menu
- Shortcodes (with a space) added to php Sample
- How can I include a file related to blog URL? Nothing seems to work
- How Can I Center the Logo in the Navigation Menu? [closed]
- Sort posts by title, sort array by largest number [duplicate]
- Get author meta of all writers
- Object of class WP_Post could not be converted to string while trying to console.log wp_get_nav_menu_items
- Check radio get value to array
- Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel
- How to create shortcode of this PHP code
- How to Set Page Pagination Using Ajax JQuery – WordPress
- How to pass and validate nonce in custom REST routes
- How to get a database field value from a WordPress table? [closed]
- Woocommerce – Include custom user meta in order ‘filter by registered customer’ Ajax search
- Slick slider not working on wordpress
- How to get ACF field to show up on all posts on front end?
- Custom post type removing /page/2/ from URL when trying to access it
- Prevent publishing of uncategorized posts