Need Assistance?

In only two hours, with an average response time of 15 minutes, our expert will have your problem sorted out.

Server Trouble?

For a single, all-inclusive fee, we guarantee the continuous reliability, safety, and blazing speed of your servers.

How to Update WordPress Site and Home URL via MySQL Command Line

When managing WordPress websites on servers without a control panel like cPanel or Plesk, tasks like updating the Site URL and Home URL can’t be done via phpMyAdmin. In such cases, you can Update WordPress Site URL and Home URL via Command Line using MySQL.

Why Change WordPress Site URL and Home URL via Command Line

You may need to update these settings if:

  • You have migrated the website to a new domain.
  • You are switching between HTTP and HTTPS.
  • You are enabling or removing www in the domain name.

Gather WordPress Database Credentials

Find the necessary database information in your WordPress configuration file: wp-config.php.

Use the following command to open it.

vim /path/to/your/wordpress/wp-config.php

Look for the following lines:

define(‘DB_NAME’, ‘database_wp261’);define(‘DB_USER’, ‘user_wp261’);define(‘DB_PASSWORD’, ‘ks1b8gdg#saylufy’);

Take note of these values — you will use them to access the MySQL database.

Login to MySQL via Command Line

Use the following command to access MySQL:

mysql -u user_wp261 -p

You’ll be prompted for the password in our example.

Select the WordPress Database

Once inside the MySQL shell, run:

SHOW DATABASES;

Select your WordPress database:

USE database_wp261;

View and Update WordPress Site URL and Home URL

Check Current Home URL

SELECT * FROM wp_options WHERE option_name = ‘home’;

Update Home URL

UPDATE wp_options SET option_value = ‘http://www.new_website_name.com/’ WHERE option_name = ‘home’;

Check Current Site URL

SELECT * FROM wp_options WHERE option_name = ‘siteurl’;

Update Site URL

UPDATE wp_options SET option_value = ‘http://www.new_website_name.com/’ WHERE option_name = ‘siteurl’;

Make sure the domain name you enter is accurate and includes the protocol (http:// or https://).

Once done verify its changed and exit MySQLFor added safety, always backup your database before making changes.

If you’re unsure about executing MySQL commands or want to avoid any potential misconfigurations, it’s best to seek expert assistance. At Skynats, our professional team offers reliable Server Management services to help you safely and efficiently Update WordPress Site URL and Home URL via Command Line.

Contact us today at www.skynats.com to ensure your WordPress site runs smoothly with expert backend support.

Liked!! Share the post.

Get Support right now!

Start server management with our 24x7 monitoring and active support team

Let us know your requirement.

Can't get what you are looking for?

Get Support Right Away!

Thank You

We have received your query and will get back to you soon.