Failed to connect to MySQL: No such file or directory
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I wrote this docker-compose project. The docker-compose.yml looks like this:
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
- MYSQL_DATABASE=mgsv
- MYSQL_USER=mgsv_user
- MYSQL_PASSWORD=mgsvpass
- MYSQL_ROOT_PASSWORD=mysql123
volumes:
- ./mysql:/docker-entrypoint-initdb.d
www:
build: ./mGSV
restart: always
ports:
- 8080:80
The index.php looks like this:
<?php
echo "Hello World!";
//mysqli_connect("localhost","my_user","my_password","my_db");
$con = mysqli_connect("localhost","mgsv_user","mgsvpass","mgsv");
// Check connection
if (mysqli_connect_errno())
echo "Failed to connect to MySQL: " . mysqli_connect_error();
else
echo "done";
?>
And the Dockerfile is based on a PHP container and looks like this.
FROM php:5-apache
RUN apt-get update && apt-get install -y --no-install-recommends
openjdk-7-jdk
maven
git
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-source extract
&& docker-php-ext-install mysql mysqli pdo pdo_mysql
&& docker-php-source delete
RUN cd /var/www/html/ && git clone https://github.com/qunfengdong/mGSV.git
# Move the folder 'mgsv' to DocumentRoot of Apache web server. By default, the DocumentRoot of Apache is /var/www/ (speak to the system administrator to know the exact DocumentRoot).
RUN cd /var/www/html/mGSV
&& mkdir tmp
&& chmod -R 777 tmp
RUN cd /var/www/html/mGSV && sed -i.bak "s|'gsv'|'mgsv_user'|" lib/settings.php
&& sed -i.bak "s|$database_pass = ''|$database_pass = 'mgsvpass'|" lib/settings.php
&& sed -i.bak "s|cas-qshare.cas.unt.edu|localhost|" lib/settings.php
RUN cp /var/www/html/mGSV/Arial.ttf /usr/share/fonts/truetype/
RUN cd /var/www/html/mGSV/ws
&& tar -xzf mgsv-ws-server.tar.gz
RUN cd /var/www/html/mGSV/ws/mgsv-ws-server
&& mvn package
RUN cp -f /var/www/html/mGSV/ws/mgsv-ws-server/target/ws-server-1.0RC1-jar-with-dependencies.jar /var/www/html/mGSV/ws/
RUN cd /var/www/html/mGSV/ws
&& echo "mgsv_upload_url=http://localhost/mgsv" > config.properties
&& echo "ws_publish_url=http://localhost:8081/MGSVService" >> config.properties
&& java -jar ws-server-1.0RC1-jar-with-dependencies.jar &
COPY ./index.php /var/www/html/
RUN a2enmod rewrite
When using http://localhost:8080/
this is the output which I got:
Hello World!
Warning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/html/index.php on line 4
Failed to connect to MySQL: No such file or directory
What did I miss?
Thank you in advance.
mysql php docker
add a comment |Â
up vote
2
down vote
favorite
I wrote this docker-compose project. The docker-compose.yml looks like this:
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
- MYSQL_DATABASE=mgsv
- MYSQL_USER=mgsv_user
- MYSQL_PASSWORD=mgsvpass
- MYSQL_ROOT_PASSWORD=mysql123
volumes:
- ./mysql:/docker-entrypoint-initdb.d
www:
build: ./mGSV
restart: always
ports:
- 8080:80
The index.php looks like this:
<?php
echo "Hello World!";
//mysqli_connect("localhost","my_user","my_password","my_db");
$con = mysqli_connect("localhost","mgsv_user","mgsvpass","mgsv");
// Check connection
if (mysqli_connect_errno())
echo "Failed to connect to MySQL: " . mysqli_connect_error();
else
echo "done";
?>
And the Dockerfile is based on a PHP container and looks like this.
FROM php:5-apache
RUN apt-get update && apt-get install -y --no-install-recommends
openjdk-7-jdk
maven
git
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-source extract
&& docker-php-ext-install mysql mysqli pdo pdo_mysql
&& docker-php-source delete
RUN cd /var/www/html/ && git clone https://github.com/qunfengdong/mGSV.git
# Move the folder 'mgsv' to DocumentRoot of Apache web server. By default, the DocumentRoot of Apache is /var/www/ (speak to the system administrator to know the exact DocumentRoot).
RUN cd /var/www/html/mGSV
&& mkdir tmp
&& chmod -R 777 tmp
RUN cd /var/www/html/mGSV && sed -i.bak "s|'gsv'|'mgsv_user'|" lib/settings.php
&& sed -i.bak "s|$database_pass = ''|$database_pass = 'mgsvpass'|" lib/settings.php
&& sed -i.bak "s|cas-qshare.cas.unt.edu|localhost|" lib/settings.php
RUN cp /var/www/html/mGSV/Arial.ttf /usr/share/fonts/truetype/
RUN cd /var/www/html/mGSV/ws
&& tar -xzf mgsv-ws-server.tar.gz
RUN cd /var/www/html/mGSV/ws/mgsv-ws-server
&& mvn package
RUN cp -f /var/www/html/mGSV/ws/mgsv-ws-server/target/ws-server-1.0RC1-jar-with-dependencies.jar /var/www/html/mGSV/ws/
RUN cd /var/www/html/mGSV/ws
&& echo "mgsv_upload_url=http://localhost/mgsv" > config.properties
&& echo "ws_publish_url=http://localhost:8081/MGSVService" >> config.properties
&& java -jar ws-server-1.0RC1-jar-with-dependencies.jar &
COPY ./index.php /var/www/html/
RUN a2enmod rewrite
When using http://localhost:8080/
this is the output which I got:
Hello World!
Warning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/html/index.php on line 4
Failed to connect to MySQL: No such file or directory
What did I miss?
Thank you in advance.
mysql php docker
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I wrote this docker-compose project. The docker-compose.yml looks like this:
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
- MYSQL_DATABASE=mgsv
- MYSQL_USER=mgsv_user
- MYSQL_PASSWORD=mgsvpass
- MYSQL_ROOT_PASSWORD=mysql123
volumes:
- ./mysql:/docker-entrypoint-initdb.d
www:
build: ./mGSV
restart: always
ports:
- 8080:80
The index.php looks like this:
<?php
echo "Hello World!";
//mysqli_connect("localhost","my_user","my_password","my_db");
$con = mysqli_connect("localhost","mgsv_user","mgsvpass","mgsv");
// Check connection
if (mysqli_connect_errno())
echo "Failed to connect to MySQL: " . mysqli_connect_error();
else
echo "done";
?>
And the Dockerfile is based on a PHP container and looks like this.
FROM php:5-apache
RUN apt-get update && apt-get install -y --no-install-recommends
openjdk-7-jdk
maven
git
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-source extract
&& docker-php-ext-install mysql mysqli pdo pdo_mysql
&& docker-php-source delete
RUN cd /var/www/html/ && git clone https://github.com/qunfengdong/mGSV.git
# Move the folder 'mgsv' to DocumentRoot of Apache web server. By default, the DocumentRoot of Apache is /var/www/ (speak to the system administrator to know the exact DocumentRoot).
RUN cd /var/www/html/mGSV
&& mkdir tmp
&& chmod -R 777 tmp
RUN cd /var/www/html/mGSV && sed -i.bak "s|'gsv'|'mgsv_user'|" lib/settings.php
&& sed -i.bak "s|$database_pass = ''|$database_pass = 'mgsvpass'|" lib/settings.php
&& sed -i.bak "s|cas-qshare.cas.unt.edu|localhost|" lib/settings.php
RUN cp /var/www/html/mGSV/Arial.ttf /usr/share/fonts/truetype/
RUN cd /var/www/html/mGSV/ws
&& tar -xzf mgsv-ws-server.tar.gz
RUN cd /var/www/html/mGSV/ws/mgsv-ws-server
&& mvn package
RUN cp -f /var/www/html/mGSV/ws/mgsv-ws-server/target/ws-server-1.0RC1-jar-with-dependencies.jar /var/www/html/mGSV/ws/
RUN cd /var/www/html/mGSV/ws
&& echo "mgsv_upload_url=http://localhost/mgsv" > config.properties
&& echo "ws_publish_url=http://localhost:8081/MGSVService" >> config.properties
&& java -jar ws-server-1.0RC1-jar-with-dependencies.jar &
COPY ./index.php /var/www/html/
RUN a2enmod rewrite
When using http://localhost:8080/
this is the output which I got:
Hello World!
Warning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/html/index.php on line 4
Failed to connect to MySQL: No such file or directory
What did I miss?
Thank you in advance.
mysql php docker
I wrote this docker-compose project. The docker-compose.yml looks like this:
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
- MYSQL_DATABASE=mgsv
- MYSQL_USER=mgsv_user
- MYSQL_PASSWORD=mgsvpass
- MYSQL_ROOT_PASSWORD=mysql123
volumes:
- ./mysql:/docker-entrypoint-initdb.d
www:
build: ./mGSV
restart: always
ports:
- 8080:80
The index.php looks like this:
<?php
echo "Hello World!";
//mysqli_connect("localhost","my_user","my_password","my_db");
$con = mysqli_connect("localhost","mgsv_user","mgsvpass","mgsv");
// Check connection
if (mysqli_connect_errno())
echo "Failed to connect to MySQL: " . mysqli_connect_error();
else
echo "done";
?>
And the Dockerfile is based on a PHP container and looks like this.
FROM php:5-apache
RUN apt-get update && apt-get install -y --no-install-recommends
openjdk-7-jdk
maven
git
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-source extract
&& docker-php-ext-install mysql mysqli pdo pdo_mysql
&& docker-php-source delete
RUN cd /var/www/html/ && git clone https://github.com/qunfengdong/mGSV.git
# Move the folder 'mgsv' to DocumentRoot of Apache web server. By default, the DocumentRoot of Apache is /var/www/ (speak to the system administrator to know the exact DocumentRoot).
RUN cd /var/www/html/mGSV
&& mkdir tmp
&& chmod -R 777 tmp
RUN cd /var/www/html/mGSV && sed -i.bak "s|'gsv'|'mgsv_user'|" lib/settings.php
&& sed -i.bak "s|$database_pass = ''|$database_pass = 'mgsvpass'|" lib/settings.php
&& sed -i.bak "s|cas-qshare.cas.unt.edu|localhost|" lib/settings.php
RUN cp /var/www/html/mGSV/Arial.ttf /usr/share/fonts/truetype/
RUN cd /var/www/html/mGSV/ws
&& tar -xzf mgsv-ws-server.tar.gz
RUN cd /var/www/html/mGSV/ws/mgsv-ws-server
&& mvn package
RUN cp -f /var/www/html/mGSV/ws/mgsv-ws-server/target/ws-server-1.0RC1-jar-with-dependencies.jar /var/www/html/mGSV/ws/
RUN cd /var/www/html/mGSV/ws
&& echo "mgsv_upload_url=http://localhost/mgsv" > config.properties
&& echo "ws_publish_url=http://localhost:8081/MGSVService" >> config.properties
&& java -jar ws-server-1.0RC1-jar-with-dependencies.jar &
COPY ./index.php /var/www/html/
RUN a2enmod rewrite
When using http://localhost:8080/
this is the output which I got:
Hello World!
Warning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/html/index.php on line 4
Failed to connect to MySQL: No such file or directory
What did I miss?
Thank you in advance.
mysql php docker
asked Mar 23 at 1:27
user3523406
477
477
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
I believe the issue here is that localhost
is not your database host. If that PHP script is running in the "www" docker container, localhost
most likely does not have a listening MySQL server. IIRC, the "file not found" error from mysqli is due to not finding the MySQL socket on localhost
. I also do not see that you are exposing any ports for the "db" image, so I am not sure how "www" is supposed to connect to a database running inside it.
You would want to find what the address to the "db" docker container is, and what port it is listening on, then reference that in your mysqli_connect()
function. An easier method, if you have a recent version of docker, would be to add your containers to the same Docker network and reference them by name.
EDIT: Docker Networking
You should read up on the networking feature in the official documentation as it is very useful. You can probably use the following docker-compose.yml (not tested):
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
- MYSQL_DATABASE=mgsv
- MYSQL_USER=mgsv_user
- MYSQL_PASSWORD=mgsvpass
- MYSQL_ROOT_PASSWORD=mysql123
volumes:
- ./mysql:/docker-entrypoint-initdb.d
networks:
- web-db-net
www:
build: ./mGSV
restart: always
ports:
- 8080:80
networks:
- web-db-net
networks:
web-db-net:
Then change your connect line to refer to the db container by name (you would also need to specify port if not using the MySQL default, 3306):
$con = mysqli_connect("db","mgsv_user","mgsvpass","mgsv");
EDIT2: fixed docker-compose.yml so that networks actually works
I'm running docker-ce 18.03. How would it be possible to add the containers to the same Docker network and reference them by name?
â user3523406
Mar 23 at 4:16
I made an edit to show some docker networking
â GracefulRestart
Mar 23 at 18:19
Thank you but I gotERROR: In file './docker-compose.yml', network must be a mapping, not a string.
. What did I miss?
â user3523406
Mar 24 at 8:43
as I mentioned, it was not tested. I just tested it and noticed my mistake. In thenetworks
key, put a colon (:
) at the end of the network name to make it a mapping. i have edited the code in my answer to reflect what I just tested.
â GracefulRestart
Mar 24 at 21:58
Thank you, but I got againWarning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/html/index.php on line 4 Failed to connect to MySQL: No such file or directory
. Any idea?
â user3523406
Mar 24 at 23:59
 |Â
show 3 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I believe the issue here is that localhost
is not your database host. If that PHP script is running in the "www" docker container, localhost
most likely does not have a listening MySQL server. IIRC, the "file not found" error from mysqli is due to not finding the MySQL socket on localhost
. I also do not see that you are exposing any ports for the "db" image, so I am not sure how "www" is supposed to connect to a database running inside it.
You would want to find what the address to the "db" docker container is, and what port it is listening on, then reference that in your mysqli_connect()
function. An easier method, if you have a recent version of docker, would be to add your containers to the same Docker network and reference them by name.
EDIT: Docker Networking
You should read up on the networking feature in the official documentation as it is very useful. You can probably use the following docker-compose.yml (not tested):
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
- MYSQL_DATABASE=mgsv
- MYSQL_USER=mgsv_user
- MYSQL_PASSWORD=mgsvpass
- MYSQL_ROOT_PASSWORD=mysql123
volumes:
- ./mysql:/docker-entrypoint-initdb.d
networks:
- web-db-net
www:
build: ./mGSV
restart: always
ports:
- 8080:80
networks:
- web-db-net
networks:
web-db-net:
Then change your connect line to refer to the db container by name (you would also need to specify port if not using the MySQL default, 3306):
$con = mysqli_connect("db","mgsv_user","mgsvpass","mgsv");
EDIT2: fixed docker-compose.yml so that networks actually works
I'm running docker-ce 18.03. How would it be possible to add the containers to the same Docker network and reference them by name?
â user3523406
Mar 23 at 4:16
I made an edit to show some docker networking
â GracefulRestart
Mar 23 at 18:19
Thank you but I gotERROR: In file './docker-compose.yml', network must be a mapping, not a string.
. What did I miss?
â user3523406
Mar 24 at 8:43
as I mentioned, it was not tested. I just tested it and noticed my mistake. In thenetworks
key, put a colon (:
) at the end of the network name to make it a mapping. i have edited the code in my answer to reflect what I just tested.
â GracefulRestart
Mar 24 at 21:58
Thank you, but I got againWarning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/html/index.php on line 4 Failed to connect to MySQL: No such file or directory
. Any idea?
â user3523406
Mar 24 at 23:59
 |Â
show 3 more comments
up vote
1
down vote
I believe the issue here is that localhost
is not your database host. If that PHP script is running in the "www" docker container, localhost
most likely does not have a listening MySQL server. IIRC, the "file not found" error from mysqli is due to not finding the MySQL socket on localhost
. I also do not see that you are exposing any ports for the "db" image, so I am not sure how "www" is supposed to connect to a database running inside it.
You would want to find what the address to the "db" docker container is, and what port it is listening on, then reference that in your mysqli_connect()
function. An easier method, if you have a recent version of docker, would be to add your containers to the same Docker network and reference them by name.
EDIT: Docker Networking
You should read up on the networking feature in the official documentation as it is very useful. You can probably use the following docker-compose.yml (not tested):
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
- MYSQL_DATABASE=mgsv
- MYSQL_USER=mgsv_user
- MYSQL_PASSWORD=mgsvpass
- MYSQL_ROOT_PASSWORD=mysql123
volumes:
- ./mysql:/docker-entrypoint-initdb.d
networks:
- web-db-net
www:
build: ./mGSV
restart: always
ports:
- 8080:80
networks:
- web-db-net
networks:
web-db-net:
Then change your connect line to refer to the db container by name (you would also need to specify port if not using the MySQL default, 3306):
$con = mysqli_connect("db","mgsv_user","mgsvpass","mgsv");
EDIT2: fixed docker-compose.yml so that networks actually works
I'm running docker-ce 18.03. How would it be possible to add the containers to the same Docker network and reference them by name?
â user3523406
Mar 23 at 4:16
I made an edit to show some docker networking
â GracefulRestart
Mar 23 at 18:19
Thank you but I gotERROR: In file './docker-compose.yml', network must be a mapping, not a string.
. What did I miss?
â user3523406
Mar 24 at 8:43
as I mentioned, it was not tested. I just tested it and noticed my mistake. In thenetworks
key, put a colon (:
) at the end of the network name to make it a mapping. i have edited the code in my answer to reflect what I just tested.
â GracefulRestart
Mar 24 at 21:58
Thank you, but I got againWarning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/html/index.php on line 4 Failed to connect to MySQL: No such file or directory
. Any idea?
â user3523406
Mar 24 at 23:59
 |Â
show 3 more comments
up vote
1
down vote
up vote
1
down vote
I believe the issue here is that localhost
is not your database host. If that PHP script is running in the "www" docker container, localhost
most likely does not have a listening MySQL server. IIRC, the "file not found" error from mysqli is due to not finding the MySQL socket on localhost
. I also do not see that you are exposing any ports for the "db" image, so I am not sure how "www" is supposed to connect to a database running inside it.
You would want to find what the address to the "db" docker container is, and what port it is listening on, then reference that in your mysqli_connect()
function. An easier method, if you have a recent version of docker, would be to add your containers to the same Docker network and reference them by name.
EDIT: Docker Networking
You should read up on the networking feature in the official documentation as it is very useful. You can probably use the following docker-compose.yml (not tested):
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
- MYSQL_DATABASE=mgsv
- MYSQL_USER=mgsv_user
- MYSQL_PASSWORD=mgsvpass
- MYSQL_ROOT_PASSWORD=mysql123
volumes:
- ./mysql:/docker-entrypoint-initdb.d
networks:
- web-db-net
www:
build: ./mGSV
restart: always
ports:
- 8080:80
networks:
- web-db-net
networks:
web-db-net:
Then change your connect line to refer to the db container by name (you would also need to specify port if not using the MySQL default, 3306):
$con = mysqli_connect("db","mgsv_user","mgsvpass","mgsv");
EDIT2: fixed docker-compose.yml so that networks actually works
I believe the issue here is that localhost
is not your database host. If that PHP script is running in the "www" docker container, localhost
most likely does not have a listening MySQL server. IIRC, the "file not found" error from mysqli is due to not finding the MySQL socket on localhost
. I also do not see that you are exposing any ports for the "db" image, so I am not sure how "www" is supposed to connect to a database running inside it.
You would want to find what the address to the "db" docker container is, and what port it is listening on, then reference that in your mysqli_connect()
function. An easier method, if you have a recent version of docker, would be to add your containers to the same Docker network and reference them by name.
EDIT: Docker Networking
You should read up on the networking feature in the official documentation as it is very useful. You can probably use the following docker-compose.yml (not tested):
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
- MYSQL_DATABASE=mgsv
- MYSQL_USER=mgsv_user
- MYSQL_PASSWORD=mgsvpass
- MYSQL_ROOT_PASSWORD=mysql123
volumes:
- ./mysql:/docker-entrypoint-initdb.d
networks:
- web-db-net
www:
build: ./mGSV
restart: always
ports:
- 8080:80
networks:
- web-db-net
networks:
web-db-net:
Then change your connect line to refer to the db container by name (you would also need to specify port if not using the MySQL default, 3306):
$con = mysqli_connect("db","mgsv_user","mgsvpass","mgsv");
EDIT2: fixed docker-compose.yml so that networks actually works
edited Mar 24 at 22:00
answered Mar 23 at 3:59
GracefulRestart
74917
74917
I'm running docker-ce 18.03. How would it be possible to add the containers to the same Docker network and reference them by name?
â user3523406
Mar 23 at 4:16
I made an edit to show some docker networking
â GracefulRestart
Mar 23 at 18:19
Thank you but I gotERROR: In file './docker-compose.yml', network must be a mapping, not a string.
. What did I miss?
â user3523406
Mar 24 at 8:43
as I mentioned, it was not tested. I just tested it and noticed my mistake. In thenetworks
key, put a colon (:
) at the end of the network name to make it a mapping. i have edited the code in my answer to reflect what I just tested.
â GracefulRestart
Mar 24 at 21:58
Thank you, but I got againWarning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/html/index.php on line 4 Failed to connect to MySQL: No such file or directory
. Any idea?
â user3523406
Mar 24 at 23:59
 |Â
show 3 more comments
I'm running docker-ce 18.03. How would it be possible to add the containers to the same Docker network and reference them by name?
â user3523406
Mar 23 at 4:16
I made an edit to show some docker networking
â GracefulRestart
Mar 23 at 18:19
Thank you but I gotERROR: In file './docker-compose.yml', network must be a mapping, not a string.
. What did I miss?
â user3523406
Mar 24 at 8:43
as I mentioned, it was not tested. I just tested it and noticed my mistake. In thenetworks
key, put a colon (:
) at the end of the network name to make it a mapping. i have edited the code in my answer to reflect what I just tested.
â GracefulRestart
Mar 24 at 21:58
Thank you, but I got againWarning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/html/index.php on line 4 Failed to connect to MySQL: No such file or directory
. Any idea?
â user3523406
Mar 24 at 23:59
I'm running docker-ce 18.03. How would it be possible to add the containers to the same Docker network and reference them by name?
â user3523406
Mar 23 at 4:16
I'm running docker-ce 18.03. How would it be possible to add the containers to the same Docker network and reference them by name?
â user3523406
Mar 23 at 4:16
I made an edit to show some docker networking
â GracefulRestart
Mar 23 at 18:19
I made an edit to show some docker networking
â GracefulRestart
Mar 23 at 18:19
Thank you but I got
ERROR: In file './docker-compose.yml', network must be a mapping, not a string.
. What did I miss?â user3523406
Mar 24 at 8:43
Thank you but I got
ERROR: In file './docker-compose.yml', network must be a mapping, not a string.
. What did I miss?â user3523406
Mar 24 at 8:43
as I mentioned, it was not tested. I just tested it and noticed my mistake. In the
networks
key, put a colon (:
) at the end of the network name to make it a mapping. i have edited the code in my answer to reflect what I just tested.â GracefulRestart
Mar 24 at 21:58
as I mentioned, it was not tested. I just tested it and noticed my mistake. In the
networks
key, put a colon (:
) at the end of the network name to make it a mapping. i have edited the code in my answer to reflect what I just tested.â GracefulRestart
Mar 24 at 21:58
Thank you, but I got again
Warning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/html/index.php on line 4 Failed to connect to MySQL: No such file or directory
. Any idea?â user3523406
Mar 24 at 23:59
Thank you, but I got again
Warning: mysqli_connect(): (HY000/2002): No such file or directory in /var/www/html/index.php on line 4 Failed to connect to MySQL: No such file or directory
. Any idea?â user3523406
Mar 24 at 23:59
 |Â
show 3 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f432976%2ffailed-to-connect-to-mysql-no-such-file-or-directory%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password