I am very confused.
I have a single Ubuntu 18.04 LAMP server. The database is localhost, i.e. running on the same server. It’s replacing a current production Ubuntu 14 web server.
L = Ubuntu 18.04 A = Apache 2.4.43 M = MySQL 5.7.29 P = PhP 5.6.40
I can connect to the mysql-client with the credentials I established, and the schema I imported.
mysql -uroot -hlocalhost -p schema_name
However, when I install my application (the same as the one installed on the current 14 server) my error.log reports:
Access denied for user 'root'@'localhost'
I’ve checked and double-checked that my application is receiving the same input for password, etc. that I’m passing to the cli client.
I created a new PHP file from this Q&A here: https://www.digitalocean.com/community/questions/why-can-t-i-connect-to-a-remote-mysql-server-from-a-php-application-but-can-connect-from-mysql-client
My file can be found here: https://gist.github.com/tneigerux/499931aae84441d1ee8c667cedac8c70
There are 60 tables
Unable to Connect to 'localhost'
I don’t think the issue has to do with Ubuntu 14 vs 18, but those are where the working and non-working examples exist.
Unfortunately this is still a PHP5.6 application, so it was harder to install the necessary LAMP version to Ubuntu 18. I did log what packages I installed. I wonder if the issue is missing software? Doesn’t make sense but I can’t think of anything else.
sudo add-apt-repository ppa:ondrej/php sudo add-apt-repository ppa:ondrej/apache2 sudo apt-get -y update sudo apt-get -y install apache2 sudo apt-get -y install git sudo apt-get -y install php5.6 sudo apt-get -y install php5.6-mbstring sudo apt-get -y install libaio1 sudo apt-get -y install php5.6-mysql sudo apachectl graceful
mysql-server 5.7.29 was also installed, but to get a compatible version, via Debian packages found here: https://downloads.mysql.com/archives/community/
I’ve deployed this application to multiple servers and never had this issue. Thanks in advance for any ideas.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.