I know there are a lot of similar posts with this but I can't seem to find the answer. I was uploading my WordPress files in the newly created directory in FileZilla. Everything was successful. I exported my database from localhost and imported it to cPanel. When I opened the Website URL given by ByetHost, it was a congratulation message. So I added a /wordpress in the URL and it redirected me to the Home Page. When I was trying to click another page, an error occured: "Error establishing a database connection". When I looked at the address bar, the link was still in localhost, like localhost/wordpress/hobby. I have changed my wp-config.php credentials with what ByetHost has given me. Even when logging in, the database error is still there. I tried doing the wp-admin/install.php, it told me I installed it already but the database error comes out when I try to login. Please help the beginner, thanks!
4 Answers
It sounds like you're running into a common pain point with local sandbox development and production server deployment.
The short story is that your database has "localhost" references in various records throughout. Once it's deployed on your production server, and you attempt any connections at "yourdomain.com", the system has a conflict between the URL and the records in your database.
The Codex has a good article on how to migrate an installation when the domain name changes. (Which is essentially what you're doing).
i think you need to change url in database , url are stored in wp_options table 'siteurl' and 'home' siteurl
if you have hardcore urls in project , then after changing url in wp_options table , you can use update url plugin to update the urls.
hope this will help you