wp-config.php is configured but database makes no connection - php

I am trying to repare my wordpress website. I installed XAMPP and made a database, but I get install.php when I want to acces my website. I tried a few things:
rename DB_NAME, DB_USER and DB_PASSWORD to match the database in wp-config.php
created a database with the information which was allready in wp-confif.php
I tried to repair the website using define(‘WP_ALLOW_REPAIR’, true);. I got errors where the database was unable to find a few tables.
I really would like to make my website work again so I can continue on my project.
Any help would be appriciated!

Related

How to get locally running copy of Wordpress Site installed on remote server?

I've spent a couple of days on this and it's probably an easy problem to fix, so I appreciate the help. I have MAMP installed and running locally with the document root path pointed to a folder named websites. In this folder I have 2 Wordpress websites, one that is working (website 1) and one that is not (website 2). I'd like help getting the Wordpress website that is not working (website 2) to work. The problem I'm trying to solve is to get a locally running version of a Wordpress site that was created using a one-click install feature from my hosting provider. This remote site has significant work that I'd like to replicate locally so I can improve it.
When I copy the remote Wordpress files, generated by my hosting provider, into my local websites folder, using FTP, Wordpress does not run at all, because it needs to connect to the database. I exported the data using phpMYAdmin from my remote site and imported it into my local phpMyAdmin and tried updating the wp-config.php file to reflect the local changes. However, the local site will not connect to the database, unless I completely reinstall Wordpress (losing all the changes to the site that I'm trying to download in the first place). The moral is I can't run the install process without losing my work.
The error that is displayed in the browser when I navigate to the second(not working) site, without running the install process, depends on what I have saved in the wp-config file:
Configuration #1: Inputs to incorrect working website 1 database - DB1
DB_Name = 'website_1_DB' //can't use this db
DB_User = 'local'
DB_Password = 'SHA1'
DB_Host = 'localhost'
localhost:8888/website1/ -> Output: Website 1 works fine
localhost:8888/website2/ -> Output: Error Establishing a Database Connection in Wordpress
Note: the above configuration was used in two different web-config.php files for both website1 and website 2.
Configuration #2: Correct DB2 and root user
For this configuration, I have confirmed in phpMyAdmin > DB2 > Privileges that root has 'All Privileges'
DB_Name = 'website_2_DB'
DB_User = 'root'
DB_Password = 'root'
DB_Host = 'localhost'
localhost:8888/website2/ -> Output: ERR_Connection_Refused
Configuration #3: Correct DB2 and added user from DB1
For this configuration, I've essentially used the user from Configuration #1 (working user) with DB2 (correct DB)
DB_Name = 'website_2_DB' //can't use this db
DB_User = 'local'
DB_Password = 'SHA1'
DB_Host = 'localhost'
localhost:8888/website2/ -> Output: It wants to run the Wordpress Install Process
Additional Information:
I have debugging turned on.
The table prefix seems to be accurate.
I've read these articles and posts.
How to Fix the Error Establishing a Database Connection in Wordpress
How to Edit wp-config.php File in Wordpress
Beginner's Guide to Wordpress Database Management with phpMyAdmin
How Wordpress Actually Works Behind the Scenes (Infographic)
Migrating a WordPress site to localhost
Connect Wordpress to the database
Wordpress: Workflows (2015)
I changed the web-config-sample.php to web-config.php essentially installing a new instance of Wordpress, which did connect to the correct DB1. However, what I'm trying to do is work on the Wordpress site that was created on the remote server. I'm trying to avoid having to reinstall the theme and update the configurations locally, but is this the only way? It seems like I should be able to move the whole installation back and forth between the server and localhost, with different configuration files, as different versions.
I think the problem is my method for migrating the website from the remote server where it was originally installed using my hosting service's 'one-click-install.' I just downloaded all the Wordpress files using FTP, then I then exported and imported the database using phpMyAdmin, updating the siteUrl to be as follows:
INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload`) VALUES
(1, 'siteurl', 'http://localhost:8888/website2/', 'yes'),
(2, 'home', 'http://localhost:8888/website2/', 'yes'),
For website 1 (working locally), I followed a tutorial, but I can't remember which one. According to this infographic, there are a lot of places for me to look, does anyone have any clue where to start? Am I on the right path? It's obviously possible since I've done it before, but I've forgotten how I did it.
The bottom line is, how do I get a locally running copy of my remote Wordpress site?
Thank you for your help.
I don't recommend moving manually as it is quite a lot of work. You could use a WordPress Backup/Migration Tool to make this task easier. These plugins replace all the URLs automatically and you don't have to do anything.
Install a backup plugin on local WordPress site like Updraft or Duplicator.
Backup your website completely with the plugin.
Research and wisely choose the best web hosting provider for your WordPress site.
Get a domain name and setup the nameserver correctly to the web host (remote server).
Install the same backup plugin on your web host (remote server).
Upload the backup of your website via the backup plugin.
Done. Now your website will be live on your domain in your web host (remote server).
NOTE: If you are using some kind of page builder plugin on WordPress like Elementor, ensure to replace the existing URL (http://localhost/) with the new URL (https://example.com) using Elementor's Settings and Regenerate the CSS using Elementor's Settings.
You can find these settings on:
WP Admin > Elementor > Tools > Replace URL
WP Admin > Elementor > Tools > Regenerate CSS
I know the paint that you faced. I also run WordPress on my VPS. You might want to check updraft plugin to backup all your remote files and install them back to your local machine.
Or another thing is, I recommended that you use duplicator plugin. Good luck

How do I connect a new project folder to an existing MAMP database?

Summary
I have an existing mySQL database on my MAMP server and I would like to connect a new site project to that database.
General Info
I have another site root folder in htdocs using that database that is working
Error: MySQL Error #2002 – The server is not responding
The site root folder is in the htdocs folder
The details with the error said my credentials are correct.
Verified that all of the above information is the same as the database
wp_options - siteurl and home are set to http://localhost:8888/my-site-folder
If my wp-config settings match the database values what else should I be looking at?
In case anyone finds this:
The only solution I discovered was to simply start a new wordpress installation with a new database. I was unable to find a way to connect to a different database.

mysql database connectivity issues

I was following this guide: http://mrbool.com/how-to-create-a-login-page-with-php-and-mysql/28656 to create a login page. I followed everything to the letter but when I uploaded the two files (login.html and connectivity.php) to my public_html folder of my godaddy linux shared hosting server and attempted to test it out, I was met with a blank page when I navigated to: mydomainname.com/connectivity.php. Now after reviewing the code within connectivity.php, my suspicion was that my mistake lay somewhere in my database setup. This is what I am referring to:
I changed the database name "practice" to the actual name of my database that I created through godaddy. I got a little bit stuck on the "DB_USER" section though. I added a user to my database through godaddy's mysql application and changed the name "root" to the name I set for the user. Here is what I'm referring to:
After I did that I changed the "DB_Password" to whatever I had set for the username's password. I thought at this point I was done but when I attempted to navigate to the page, it still didn't work. I know the "DB_HOST" is set to localhost but I wasn't sure what I was supposed to change that to since phpMyAdmin panel stated the following: "Server:localhost" even though I'm using a server. I added all the tables and users to the mysql database correctly so I really think this has something to do with my configuration. If anyone could help me I would greatly appreciate it. Thanks.

Uploading Wordpress site

So, I have created a wordpress site with database and everything. I used the plugin "duplicator" to store a backup. I now have a folder with all the wordpress php-files and a sql-file as well. Im using localhost.
Now Im trying to upload it to a webhost but Im having some problems to make it work.
Right now Im using Cpanel but I don't understand how to import the wordpress files.
What I have done so far is installing Wordpress with softaculous, checked, tried to upload sql-file in phpmyadmin, not checked, and tried to upload all the wordpress files to public_html, not checked as well.
Does it exist any easier way to upload all files to a webhost or could anyone guide me through the progess. I would be grateful!
If I have forgotten to mention anything please tell me.
Thanks!
Please follow the steps:
Upload all the wordpress files and folder on you hosting using cPanel
Import the database using the PhpMyAdmin.
Make the necessary changes in the wp-config i.e the DB_NAME(Database name),
DB_USER(Name of the user whom the database privileges are assigned to), DB_PASSWORD, DB_HOST
Then later execute the following query, note: wp_ is prefix of table. If you have changed the prefix of the table at the time of installation then use that prefix with wp_ in the below query
UPDATE wp_options SET option_value = replace(option_value, 'old_domain_url_here', 'new_domain_url_here') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'old_domain_url_here', 'new_domain_url_here');
UPDATE wp_posts SET post_content = replace(post_content, 'old_domain_url_here', 'new_domain_url_here');
For more details please visit the below link:
http://www.wpbeginner.com/wp-tutorials/how-to-move-wordpress-from-local-server-to-live-site/
There are actually a few really good tutorials on the web. Have a look at this link:
http://www.jasonbobich.com/web-design/moving-wordpress-to-a-new-server/#comment-2117
Use FileZilla to upload the actual content: https://filezilla-project.org
You will need your Host, ex example.com, Username and password details provided by your web host to upload your site.
The above tutorial explains everything step by step, very useful.

cakephp is not able to connect to database

I am a cakephp newbie and I tried to setup my connection to mysql. I had it worked before but after I changed my mysql database name, it won't connect anymore even thought I changed the database name in database.php inside the config folder. Do I have to run the cakephp console again??
Your tmp directory is writable.
The FileEngine is being used for caching. To change the config edit APP/config/core.php
Your database configuration file is present.
Cake is NOT able to connect to the databa
Above is the message shown.
Any ideas what I have to do? Thanks a lot!
Make sure that the new database allows the user in the database.php file to have access to the new database. Look at the MySQL GRANT syntax.

Categories