zoukankan      html  css  js  c++  java
  • Changing the WordPress site URL using the MySQL command line

    If you have been locked out of your WordPress admin panel because the IP address of your server changed or some other reason, you will need to log in to MySQL directly and manually change two values in the wp_options table.

    If you don’t remember your MySQL username and password, you can look it up in your wp-config.php file. From that file you will need the following values: DB_NAME, DB_USER, and DB_PASSWORD.

    First log in to the MySQL command line using the following command:

    mysql --user <DB_USER> -p
    You should be prompted for your password.

    Once you have the MySQL command line open you can issue the following commands. Some of these are unnecessary and are only for informational purposes.

    SHOW DATABASES;
    USE <DB_NAME>;
    SHOW TABLES;
    SELECT option_name FROM wp_options;
    Here you should see a list of all of the columns in wp_options. The ones we are interested in are “home” and “siteurl”. Next issue the following commands on the MySQL command line to update the values in the database. For each of the option_value parameters below, ensure to set it to the URL of your WordPress install.

    SELECT * FROM wp_options WHERE option_name = 'home';
    UPDATE wp_options SET option_value="http://new_host/wordpress" WHERE option_name = "home";

    SELECT * FROM wp_options WHERE option_name = 'siteurl';
    UPDATE wp_options SET option_value="http://new_host/wordpress" WHERE option_name = "siteurl";
    Once the above changes have been made, you should once again be able to access your WordPress login page.

  • 相关阅读:
    数据分析之异常值分析-箱线图
    PHP学习路线图(转)
    学习简易爬虫设计(转)
    学习扫码登录的例子
    2017年PHP程序员未来路在何方(转)
    一个PHP开发APP接口的视频教程
    PHP实现Restful风格的API(转)
    大型网站技术架构-入门梳理(转)
    PHP面试总结(转)
    大型网站系统架构的演化(转)
  • 原文地址:https://www.cnblogs.com/emaes/p/15747024.html
Copyright © 2011-2022 走看看