WordPress, Apache, MySQL, and Mac - php

I tried setting up WordPress on a Mac, I got Apache running, PHP is up and going and MySQL is running. I put WordPress in library/webserver/documents and I visit localhost/wordpress/wp-admin to do the install, and get an error establishing database connection.
So I check the database information and password and database name. Everything is correct down to the last syllable in the password, name and database name....
Why am I getting this? I have set up WordPress on Ubuntu and Windows without any issue, but why does a Mac present a problem?
With wp_debug on, it states my password is wrong. I have tried logging into MySQL with the password given and the user name - it works... so that is clearly not wrong...

If you're using MAMP, make sure that the disk location of the virtual host is correctly configured. I.e., pointing to library/webserver/documents.

Related

Why am I getting so many error messages in phpmyadmin localhost?

I just set up XAMPP and, when I start the Apache localhost, it displays all of these errors when I search "localhost/phpmyadmin"
I am very new to this (just downloaded XAMPP) and I watched this tutorial: https://www.youtube.com/watch?v=hqfIksHKPPg on setting it up (I didn't install phpmyadmin since it was already installed with XAMPP)
I edited the notepad text files as stated in the video, but instead of a login, I get all of the error messages shown in the above picture...
I also opened config.inc.php and edited the line:
['Servers'][$i]['(MySQL root password)'] = '';$cfg
so it matched MySQL root password
Even if you have a suggestion to fix one of the errors, please still comment
Also, if you need any more information please let me know
You're getting several error messages because you have several problems :)
Cannot connect: invalid settings
Some setting is incorrect, most likely something in your config.inc.php is misspelled or incorrectly copied and pasted. Specifically, if the line ['Servers'][$i]['(MySQL root password)'] = '';$cfg is actually how it appears in your configuration, that is clearly the problem as the line should actually be $cfg['Servers'][$i]['password'] = 'green'; except with you password instead of 'green'...except that only applies if your auth_type is 'config', otherwise the 'password' line isn't used at all (since you're prompted for the password at log in). I'm not sure what XAMPP does here for auth_type, but I don't think you should have had to edit the configuration file at all, since you used the XAMPP installer which should have configured everything.
The server requested authentication method unknown to the client [sha256_password]
This appears to be a bit of a version mismatch in your installed files. Access denied after setting user's password with SHA256 in phpMyAdmin goes in to more detail, but this most often occurs when you've got MySQL 8 and PHP older than 7.4. Normally, I'd suggest upgrading your PHP version — but you're using the packaged XAMPP, which certainly wouldn't ship with conflicting MySQL and PHP versions, so something is odd here. Please confirm for us your MySQL and PHP versions. You didn't happen to have an existing MySQL or PHP installation before you installed XAMPP, did you?
Connection for controluser as defined in your configuration failed
This is probably related to the MySQL 8/PHP 7.4 conflict. There is an administrative user (called the controluser) that phpMyAdmin can use to manage some extra features, ordinarily you wouldn't need it to access phpMyAdmin (only to access those additional features), but it seems XAMPP has configured this for you. Since the authentication fails, you get an additional message that the controluser was not able to connect.
You could bypass this by commenting out the configuration lines referencing controluser and controlpass, although again the XAMPP package should have this all configured so I don't recommend that at this point.
The other messages are basically echoes of the previous messages; you get an additional protocol notification because the controluser is trying the same sha256 connection type that the main user was, and then finally phpMyAdmin is telling you that MySQL rejected the connection.
If this is a fresh XAMPP install, I'd suggest reinstalling, because something got a bit confused. I'd also suggest making sure that you don't have any other conflicting software running — XAMPP is a package of all the included parts, so you don't want to install or run your own Apache or MySQL instance which would interfere with the packaged kit.

Where is /usr/local/lib on online server

I have a server hosted on 000webhost.com
In the file manager there is a public_html folder where I store my website files, but no \usr folder.
Generally I could just access this file through the command line or terminal but this is not the case on this server. Unless there are command line tools that I simply couldnt find (I know it is a linux server);
I ran phpinfo() and the configuration file path was in usr/local/lib but I have no idea how to access that.
Any ideas? Thanks in advance.
Go to http://www.000webhost.com/faq.php look at the section on connecting to MySql. Your solution is likely there.
Here is a synopsis:
If you cannot connect to MySQL server, there could be some causes:
- Incorrect MySQL hostname.
Never use 'localhost' as your MySQL hostname! You can find your MySQL hostname by logging on to members area, entering control panel and clicking on MySQL icon.
- Incorrect MySQL username / password or database name.
You can find / setup MySQL username and database by clicking on MySQL icon from control panel. And you can change MySQL password by clicking on phpMyAdmin icon.
- Database failed to setup.
In a very rare cases MySQL database can fail to setup. To confirm this, please try to enter phpMyAdmin for any database. If you see database there, that means it setup was successful. And if you get access denied error by trying to enter phpMyAdmin, please delete the database and setup the same MySQL database again.
Please note that always you must give about 1 minute for any changes to apply on server.
If you still unable to connect to MySQL you check if it is server or your script problem in this way: if you can enter phpMyAdmin and see you database there, that means everything is working fine on our side. It's a problem with your PHP script.

phpMyAdmin unable to connect to MySQL Server

I have been using xampp 1.7.4 on a local installation php version is 5.3.5 for several years without any problems. I develop Joomla! websites offline and then upload to the server.
My phpMyAdmin stopped working, giving this error message:
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
I am a complete dummy with servers and NEVER fiddle with settings I do not fully understand.
Can anyone please advise?
Go inside your phpMyAdmin directory inside XAMPP installation folder. There will be a file called config.inc.php. Inside that file, find this line:
$cfg['Servers'][$i]['password'] = ''; you must make sure that this field has your mysql root password (the one that you set).

wamp server 1045 error?

I had installed wamp server and joomla on my local machine. It was giving phpmyadmin no access error 1045. I followed some instructions on the net and everything was fixed. I had to delete that installation because on error in joomla installation. Now when I am trying to install wamp again I am getting the same phpmyadmin error. Tried everything but could not get it working.
Sounds like you might be using the wrong username, password, or host to log in. Or have a mismatch between what you think it's set as, and what it really is set as in the database.
Or phpmyadmin's config.inc.php file has the wrong account info, or is using the wrong method to log in.
Try another WAMP package and be careful when changing database account info (know what the account's Host field is for, it should always be localhost or 127.0.0.1).
http://en.wikipedia.org/wiki/Comparison_of_WAMPs
Have you tried entering your root password into the config.inc.php file (found in Wamp's apps > phpmyadmin folder)? (Also, have you seen this thread at Wamp's official site?)

Wordpress installation - php and mysql are not talking to each other to access database?

I'm trying to get a wordpress local install working on my Mac.
I've recently set up a database, username and password using the MySQL client as per the instructions in the wordpress codex. That part is ok.
When I go to the local site on my computer I'm prompted by wordpress to set up the wp-config.php file. Putting in the same details that definitely work with the MySQL client returns an error.
Manually updating these details in the 'wp-config-sample.php' file and renaming it as 'wp-config.php' also doesn't work - I'm now greeted with a big bold message: "Error establishing a database connection".
From what I can gather, php and mysql are not communicating with each other properly.
I've changed the apache 2 configuration file found in 'etc/apache2/httpd.conf' and uncommented the line which loads the php5 module: LoadModule php5_module libexec/apache2/libphp5.so
and restarted the apache server. This has still not fixed my problem. I'm stuck on what to do next... help appreciated please!
It's been fixed now.
php was looking in the wrong place for the mysql.sock file, and couldn't communicate with the mysql database, meaning wordpress couldn't be set up.
On the command line I typed
ps aux | grep mysql
to bring up as much info about mysql that I could. From this I saw that the mysql socket on my computer is being used at /tmp/mysql.sock
Meanwhile, in the "wp-config.php" file, I changed the line define('WP_DEBUG', false); to define('WP_DEBUG', true); and refreshed my web browser that was showing my localhost setup. This now said a lot more info than "Error establishing a database connection" - infact I could see that the mysql.sock was not configured correctly at all.
Creating a 'phpinfo.php' file with just the single line of code <?php phpinfo(); ?> was the pivotal turning point for me.
Putting that 'phpinfo.php' file in my localhost directory and then viewing it from my web browser not only definitely confirmed that the mysql.sock file was not configured properly, but it also showed where the configurations were being loaded from on my machine: '/private/etc/php.ini'
The next thing I did was open up the 'php.ini' file in a text editor and doing a quick find and replace to update the correct location of mysql.sock.
Finally, a restart of the local apache server needed to be done to fully update all the new settings that I'd been fiddling about with.
sudo apachectl restart
Now everything works fine!
The Error-Message "Error establishing a database connection" indicates clearly, that the php-script can not establish the connection. This can have one of the following reasons:
Your host in the wp-config.php is not correct.
The mysql-server does not listen on that host
The user you set up in the mysql has no privileges to connect the way you are trying
The firewall blocks the access of the php-script to your mysql-host
Try to connect the database with the same settings of your wordpress using Sequel Pro (or any other GUI to connect a mysql database). If the connection works, the problem 2. and 3. isn't your problem.
Look in your firewall-log to make sure 4. is also not your problem.
If all problems are excluded (even 1. after a final check), try to run something like phpMyAdmin to connect your database, to make sure your php-installation has the needed drivers.

Categories