wp config - Cloned site not connecting to database - MAMP

admin2025-01-07  8

First off, I'm a WordPress noob, so I apologize if there is an easy solution. I'm trying to get a live website working on my local MAMP environment. I've successfully cloned the git repo into the htdocs directory in MAMP. I also also created a database within phpmyadmin called 'landing'. Once the database was created, I imported a fresh copy of the production site's database.

After the database was set up, I renamed the wp-config-example.php file to wp-config.php and added the following properties:

define('DB_NAME', 'landing');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', 'root');

/** MySQL hostname */
define('DB_HOST', 'localhost');

Nonetheless, when type in my local site's URL, it takes me to the WordPress install page. Am I missing a step? I've already double checked the database name, username, and password to make sure they are accurate.

Edit: I eventually realized that I was using the wrong prefix. Instead of "wp_", the prefix used is "wp_landing". However, when I made the change, my site become unaccessible. It throws the following error:

This site can’t be reached
localhost refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED

First off, I'm a WordPress noob, so I apologize if there is an easy solution. I'm trying to get a live website working on my local MAMP environment. I've successfully cloned the git repo into the htdocs directory in MAMP. I also also created a database within phpmyadmin called 'landing'. Once the database was created, I imported a fresh copy of the production site's database.

After the database was set up, I renamed the wp-config-example.php file to wp-config.php and added the following properties:

define('DB_NAME', 'landing');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', 'root');

/** MySQL hostname */
define('DB_HOST', 'localhost');

Nonetheless, when type in my local site's URL, it takes me to the WordPress install page. Am I missing a step? I've already double checked the database name, username, and password to make sure they are accurate.

Edit: I eventually realized that I was using the wrong prefix. Instead of "wp_", the prefix used is "wp_landing". However, when I made the change, my site become unaccessible. It throws the following error:

This site can’t be reached
localhost refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
Share Improve this question edited May 10, 2017 at 20:40 Kellen asked May 8, 2017 at 20:52 KellenKellen 1031 silver badge5 bronze badges 1
  • Instead of define('DB_PASSWORD', 'root'); write define('DB_PASSWORD', '');. In local environment (if you didn't change anything) the db_password would be nothing, so an empty string – Buttered_Toast Commented Nov 11, 2020 at 12:00
Add a comment  | 

1 Answer 1

Reset to default 0

Did you check if the table prefixe in wp-config is same as per your database..

To check the table prefix of your database go to phpmyadmin. Click on your database and expand it If you notice in following image , you will find out that all the table have prefix "wp_" .. so that means in your wp-config this should be the setting

$table_prefix = 'wp_';

else if you see some thing else in phpmyadmin , then you can replace wp_ in above setting as per your database

Please let me know if this fixes your problem

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736264733a990.html

最新回复(0)