To change a WordPress URL in a MySQL database using phpMyAdmin, you can use SQL queries to update the relevant fields. The most common approach is to update the wp_options table, specifically the home and siteurl options. The following SQL query can be used:
UPDATE wp_options SET option_value = replace(option_value, 'http://old_url', 'http://new_url') WHERE option_name = 'home' OR option_name = 'siteurl';
This query replaces all instances of the old URL with the new URL in the specified options. Additionally, you may need to update other tables such as wp_posts, wp_links, and others if there are references to the old URL in post content, image links, or other fields. For example:
UPDATE wp_posts SET guid = replace(guid, 'Existing URL', 'New URL');
UPDATE wp_posts SET post_content = replace(post_content, 'Existing URL', 'New URL');
UPDATE wp_links SET link_image = replace(link_image, 'Existing URL', 'New URL');
These queries ensure that all instances of the old URL are replaced across different parts of the database. You can also use tools or plugins like the “Better Search Replace” plugin to simplify the process. Always make sure to back up your database before making any changes to avoid data loss.