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.

  • 相关阅读:
    算法: 整数中1出现的次数(从1到n整数中1出现的次数)
    健身:肩部训练
    算法: 字符串的排列
    不能浮躁,还是需要沉淀;
    算法:从上往下打印二叉树
    健身:手臂训练
    抛出错误
    记录错误
    调用栈
    try/except/finally
  • 原文地址:https://www.cnblogs.com/emaes/p/15747024.html
Copyright © 2011-2022 走看看