Error establishing a database connection on localhost xampp os x - php

i am very beginner in wordpress and want to learn it and the first step was fail :(
i tried to install it on localhost (xampp) and this error "Error establishing a database connection" kept shows
i did every step in this video https://www.youtube.com/watch?v=A3fXcvnzlkw
install xampp-osx-5.6.30.
turn on mysql database and apache server.
go to phpmyadmin and add new database name it "wp".
download wordpress 4.7.2
copy the wordpress folder to htdocs then rename it to wp.
go to wp-sample-config rename it to wp-config change the database name to wp, database username to root and database password empty ''.
in the browser localhost/wp/wp-admin/install.php
then the error shows
i tried to add new user in the phpmyadmin and change the wp-config
i tried to change the database host from localhost to 127.0.0.1 in wp-config
i tried to unistall xampp twice
i tried different program mamp
nothing helped
my os x version is os x yosemite 10.10.5
should i change any sittings in my computer?
is there any programs that i may install it causes the problem?
what can i do?
here some photo
wp-config /

Steps 6 and 7 aren't needed. WordPress creates the wp-config.php file when it discovers that there isn't one there. It prompts you for the database username, password, server (default localhost) and table prefix that you want.
Then it will ask you for some information about the site. Normally that's all you need to do, it will set up wordpress for you from this information. It might not like an empty password for the database user though. If you haven't changed the password you could try root as I think that is the default - root/root
You need to check first that xampp is working correctly though e.g. by outputting a simple html file.

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

phpMyAdmin on macOS: where does it save config.inc.php?

Downloaded the latest phpMyAdmin to be used on macOS 10.15 Catalina (local webserver), extracted the phpMyAdmin files to my web root.
During the setup I chose config authentication and now when I visit the setup page I'm getting some mysqli error.
I deleted the entire phpMyAdmin/ dir and wanted to start all over again. However to my surprise, the previously entered (incorrect) server details are still there.
I would assume the any config.inc.php would be saved within phpMyAdmin's own dir, but apparently it's saving this data somewhere else.
How/where can I find it, so I can delete it and truly start a complete new phpMyAdmin setup from scratch?
P.S. I already tried:
/etc/phpmyadmin/
/usr/local/phpmyadmin/
/usr/local/etc/phpmyadmin/
/usr/local/opt/phpmyadmin/
But neither of these dirs exist.
If you've simply downloaded the phpMyAdmin file yourself and uncompressed it to your web root, then the config.inc.php file goes in that phpMyAdmin folder. If you've used brew or some other package manager, they each have their own location for configuration files, but that doesn't seem to be the case here.
It's not clear why the old server details have been retained, maybe your browser has cached the old page or something, but the only place that phpMyAdmin looks for the configuration is in the main folder. Is there a chance you're seeing the defaults, rather than some custom setting? (The defaults would be to use auth_type cookie connecting to host 'localhost').
What is the specific mysqli error message you're seeing?

wp core install cannot connect to database with WP-CLI

I don't know why it's doing this but for some reason, when I try to install WordPress with WP CLI with wp core install, it cannot complete and throws the Error: Error establishing a database connection error.
I've checked everything and I'm not sure what the issue is. I'm using MAMP PRO and all of the settings in the wp-config.php file are correct.
I'm connecting via localhost and the database is created just fine and I can see that there.
I've tried changing localhost to 127.0.0.1 in the wp-config file, but that borks outright.
Username and Password to connect are the default of root and root.
If I go to the local URL directly, I can see the WP install screen and then after I select the language, it redirects me to the setup where I can name the site, username, password, etc. I never see the DB connection info at all.
I did have to set this in my .zshrc file:
export PATH=$PATH:/Applications/MAMP/Library/bin/ cause it was having an issue when creating the wp-config file with wp config create, but once I added that, it was able to create the wp-config file without errors, so maybe that might be an issue? But overall, I'm stumped. I had a bash script that was working to generate all of this automatically, but now I'm not sure what the issue could be since it appears everything is setup correctly.
If you're running on Mac and using MAMP, update hostname in wp-config.php
define( 'DB_HOST', 'localhost:/Applications/MAMP/tmp/mysql/mysql.sock' );

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.

PHPMyAdmin error after updating EasyPHP

I recently updated a version of my windows based Apache server (I'm using EasyPHP) and I'm having issues with PHP MyAdmin. With the old version(13.1 VC9), I'm able to connect to the MyAdmin page, no problem. However, I am not able to connect using the new version(14.1 VC9). The error I get with the new version is:
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
127.0.0.1
Apache/2.4.7 (Win32) PHP/5.4.24
What do I need to do to be able to re-access PHPMyAdmin.
You should simple open http://127.0.0.1/home/
And here you have sections modules. You should have here at least one phpmyadmin and when you click it, it will open phpMyAdmin.
If you want to use alias - for example you want to load phpmyadmin using http://phpmyadmin you will have to create it.
So go again to http://127.0.0.1/home/ and check if below phpmyadmin modules you have Virtual Hosts Manager 1.4 . If not, close easyphp , go to http://www.easyphp.org/modules.php, download and install Virtual Hosts Manager (choose the one for 14.1 VC9).
After you start again easyphp you should have at http://127.0.0.1/home/ your Virtual Hosts Manager 1.4 . Now simple click on "Add virtual host", as a name you can for example insert phpmyadmin and in path directory you should insert the whole system path to directory where you have phpmyadmin. For example mine is **D:\DaneAplikacji\easyphp\modules\phpmyadmin420x140509165737**. Save it and now you will be able to open phpmyadmin using your alias as for example http://phpmyadmin

Categories