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
- The correct method to pass query vars in AJAX using ajaxurl
- Display user’s total comment count outside The Loop
- Getting the action’s tag name within the action
- WordPress Infinite Scroll without using any plugin
- Add post class to the TinyMCE iframe?
- Admin Bar (Toolbar) not showing on custom PHP file that loads WordPress
- How to add query vars with paginated URLs?
- How to change “Shipping Calculator “field label on Cart Page – woocommerce? [closed]
- How to Join two tables from separate databases within WordPress
- How to find objects by terms
- Changing Link Attributes for Wp_Link_Pages
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- How to change
- Get only the grandchildren, not the direct children of page/current page?
- How does WooCommerce ensure that a product doesn’t run out of stock during payment? [closed]
- Can I change a variable in a content part while calling it?
- How do you target virtual pages in code?
- Placing the_content inside shortcode not working
- Must Use Plugin Causing Query Error
- action hook wp_head higher priority as all other plugins/hooks
- Shortcode return function with link href inside PHP
- How can I add an alert (like the old javascript alerts) to my WP page?
- PHP get the first post separately from array returned by wpdb->get_results()
- How to use transient in this code for related post?
- Why is $_REQUEST an empty array in admin-ajax.php?
- Change behavior of the tag
- Is it acceptable to treat a filter like an action?
- Woocommerce hook run after an Order been created through REST API
- Fetch post block/field data as JSON with WordPress API
- How to design a table based on css values set from admin/dashboard
- How to pre populate a form field with a link of a current user’s author profile?
- wp_head function not outputting
- PHP echo inside javascript
- Value prints outside of the echo
- If ‘editor’ is empty, then
- Different Subdomain changes page content
- Removing the comment function within wordpress
- php redirect with custom user roles set and working but redirect not working for when users are logged in
- Display Yoast meta-description `wpseo_desc` within loop of categories and fail silently if no data is set [closed]
- Does get_post function counts as view?
- Get ACF options field in PHP acting as CSS
- Permalinks are not working in WordPress in digitalocean
- Bootstrap Carousel HTML structure and funny output [closed]
- Amend theme php to include certain category in header
- add category to posts with tag wordpress
- Missing a text-domain esc_attr_e
- Get all posts from categories
- How to add post classes?
- How to insert data from metabox to custom table
- How to Generate a list of Most Commented post?
- Updating From Mobile App – Exposing Site to Hacking
- is user member of a group, show them categories [closed]
- How to add ASCII symbol after each recent post [closed]
- How can i programmatically change the SKU of a product based on product variation?
- Export post data with xml to other site using php soap
- Execute PHP code only with specific user role
- Repeat a function with 24hrs gap for n number of days
- Add a custom WooCommerce settings tab with sections
- How to serve WordPress folder over subdomain?
- How to call my PHP function with AJAX ? wp_query
- How to route root path / to /xyz in nginx?
- Get the same SKU from woocommerce itself for simple and variable products
- Show sidebar only to author of post
- No more get_option(‘date_time’) in WordPress 5.5?
- how to add custom select field to wordpress edit page
- How to update post content of all posts with tag?
- Make WooCommerce product categories only show images on homepage
- How to Change Site Elements based on referring URL
- WP post meta – for loop inside for loop
- WordPress Query Crashes Browser
- Matching multi user
- WordPress using get_term to retreive slug not working as expected
- auto metakey value on post tile
- Static home page ignored
- On a custom template, should I use wp_footer? [duplicate]
- Front end post submissions do not get submitted in the category
- How to pass parameter that ends up being part of a class name with wordpress shortcode
- how to check for wordpress Query errors
- calling a function from a class in your template
- Custom single.php files for different post formats
- Troubleshooting “loopback requests that take too long”
- AJAX & PHP | Call a specific PHP function from a PHP file via AJAX?
- Order woo products, but first products must be with acf fields
- Remove /category/ from category (archive) page URLs (without using a plugin)
- JSON Object Value Show Undefine
- how to display tables via ajax
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress