• I think this is more of an issue with my wamp setup but here goes.

    Inside my wp-config for my wordpress if I have the /** MySQL hostname */ set to localhost or 127.0.0.1 then i get “Error establishing a database connection” when trying to access my site.
    If I put in 192.168.0.42 (My local network IP address) then everything works fine.

    But I need to use localhost because I connect with different machines on my network. How can I fix this?

    Thanks.

Viewing 1 replies (of 1 total)
  • You shouldn’t need to fix anything. If your MAMP server’s address is 192.168.0.42 (static, not dynamic) then that IP and ‘localhost’ are for your purposes equivalent as far as the WordPress (wp-config.php) configuration on that MAMP server is concerned, so long as Apache, PHP, MySQL, and WordPress are all on the same machine (Static IP = 192.168.0.42). They aren’t equivalent if MySQL is on a separate machine from the Apache, PHP, and WordPress parts. If the IP lets you get a connection, I see no reason why other computers on the network can’t access the site. Remember, that address is used by the WordPress software itself, so the connection to the MySQL server is always from the machine with the server running WordPress, and not from the individual machines viewing the site. Hope that makes sense. If it doesn’t work that way, I suspect that you have some networking problems. Have you tried to use the IP and found that other computers on the network cannot connect?

    From the machine running MAMP, does https://localhost take you to MAMP’s web root?

Viewing 1 replies (of 1 total)
  • The topic ‘wp-config setup issues’ is closed to new replies.