Re: [PHP-DB] Can connect to Mysql via command line but not via browser

2020-10-12 Thread Roberto Carlos Garcia Luis
Please try with this answer...

https://stackoverflow.com/questions/41178774/connect-database-error-type-2002-permission-denied


El jue., 3 sept. 2020 a las 17:23, Tai Larson ()
escribió:

> The are connected to the same network.  I’m setting up a development
> environment.
>
> From: Aziz Saleh 
> Sent: Thursday, September 3, 2020 3:09 PM
> To: Tai Larson 
> Cc: php-db@lists.php.net
> Subject: Re: [PHP-DB] Can connect to Mysql via command line but not via
> browser
>
> Are both connected to the same network? Just asking because I see a local
> ip for server ip/name. Maybe try with public IP instead see if it helps.
>
> On Thu, Sep 3, 2020 at 5:51 PM Tai Larson  tai.lar...@weierlaw.com>> wrote:
> I have a MySQL database server and a separate web sever running Apache.
> Both are running Centos 8.
>
> I can connect to my database server from my web server via the command
> line, but I get permission denied whenever I try to connect to the server
> via a browser.
>
> Here is the code I'm running:
>  $servername = "192.168.10.XXX";
> $username = "root";
> $password = "123456789";
> $conn = new mysqli($servername, $username, $password); if
> ($conn->connect_error) {
>   die("Connection failed: " . $conn->connect_error); } echo "Connected
> successfully"; ?>
>
> I SSH into my web server and run this command "php TestMySQL.php".  I
> receive the output of "Connected successfully".
>
> When I attempt through my browser or curl, I receive the output of
> "Connection failed: Permission denied".
>
> I can also connect to the remote database with the local mysql client.
>
> Thank you all in advance for your help.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


RE: [PHP-DB] Can connect to Mysql via command line but not via browser

2020-09-03 Thread Tai Larson
The are connected to the same network.  I’m setting up a development 
environment.

From: Aziz Saleh 
Sent: Thursday, September 3, 2020 3:09 PM
To: Tai Larson 
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Can connect to Mysql via command line but not via browser

Are both connected to the same network? Just asking because I see a local ip 
for server ip/name. Maybe try with public IP instead see if it helps.

On Thu, Sep 3, 2020 at 5:51 PM Tai Larson 
mailto:tai.lar...@weierlaw.com>> wrote:
I have a MySQL database server and a separate web sever running Apache.  Both 
are running Centos 8.

I can connect to my database server from my web server via the command line, 
but I get permission denied whenever I try to connect to the server via a 
browser.

Here is the code I'm running:
connect_error) {
  die("Connection failed: " . $conn->connect_error); } echo "Connected 
successfully"; ?>

I SSH into my web server and run this command "php TestMySQL.php".  I receive 
the output of "Connected successfully".

When I attempt through my browser or curl, I receive the output of "Connection 
failed: Permission denied".

I can also connect to the remote database with the local mysql client.

Thank you all in advance for your help.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Can connect to Mysql via command line but not via browser

2020-09-03 Thread Aziz Saleh
Are both connected to the same network? Just asking because I see a local
ip for server ip/name. Maybe try with public IP instead see if it helps.

On Thu, Sep 3, 2020 at 5:51 PM Tai Larson  wrote:

> I have a MySQL database server and a separate web sever running Apache.
> Both are running Centos 8.
>
> I can connect to my database server from my web server via the command
> line, but I get permission denied whenever I try to connect to the server
> via a browser.
>
> Here is the code I'm running:
>  $servername = "192.168.10.XXX";
> $username = "root";
> $password = "123456789";
> $conn = new mysqli($servername, $username, $password); if
> ($conn->connect_error) {
>   die("Connection failed: " . $conn->connect_error); } echo "Connected
> successfully"; ?>
>
> I SSH into my web server and run this command "php TestMySQL.php".  I
> receive the output of "Connected successfully".
>
> When I attempt through my browser or curl, I receive the output of
> "Connection failed: Permission denied".
>
> I can also connect to the remote database with the local mysql client.
>
> Thank you all in advance for your help.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>