I am a totally beginner at Shopware and I want to use PhpMyAdmin for my local Shopware 6 setup.
For the download I used the official Shopware 6 Development repository https://github.com/shopware/development
I've already seen that the docker-compose.yml has implemented the following:
app_mysql:
build: dev-ops/docker/containers/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: app
MYSQL_PASSWORD: app
networks:
shopware:
aliases:
- mysql
and now I want to implement phpmyadmin. I tried the following:
phpmyadmin:
image: phpmyadmin/phpmyadmin
links:
- app_mysql:mysql
depends_on:
- app_mysql
ports:
- 8181:80
environment:
PMA_HOST: app_mysql
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: app
MYSQL_PASSWORD: app
phpmyadmin is visible on localhost:8181 but when I try to login I get the following errors:
mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known
mysqli::real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known
How can I solve it?
Usually phpmyadmin should be in the same network as the database.
Service names are resolved to the IP addresses of the containers, therefore it's recommended to use names allowed by RFC1035 to avoid additional problems.
I removed links:, aliases, depends_on that are deprecated/not required and ended up with this docker-compose.yml.
version: '3.7'
services:
app-mysql:
#build: dev-ops/docker/containers/mysql
image: mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: app
MYSQL_PASSWORD: app
networks:
- shopware
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 8181:80
environment:
PMA_HOST: app-mysql
PMA_PORT: 3306
PMA_ARBITRARY: 1
networks:
- shopware
networks:
shopware
Run the containers:
docker-compose up
Open http://localhost:8181/index.php in a browser.
Use
Server: app-mysql
Username: root
Password: root
Enjoy:
You must use as host mysql or app_mysql
It is not an answer, but try
http://localhost:8001/
it is not phpMyAdmin but it is another tool Adminer :)
You should link phpmyadmin and mysql using
links:
- app_mysql:mysql
use it as :
links:
- mysql
Add environment:
`PMA_HOST`: mysql
Related
I setup my docker mysql and phpadmin via
version: '3.2'
services:
mysqllocal:
image: mysql:8.0
container_name: container_mysqllocal
restart: always
ports:
- '6603:3306'
environment:
MYSQL_ROOT_PASSWORD: pass1234
MYSQL_ROOT_HOST: '%'
phpmyadmin:
depends_on:
- mysqllocal
image: phpmyadmin/phpmyadmin
container_name: container_phpmyadmin
restart: always
ports:
- '8080:80'
environment:
PMA_HOST: mysqllocal
UPLOAD_LIMIT: 3000000000
docker inspect container_mysqllocal and got '172.30.0.2'. However when I tried to connect mysql via SequelPro. It gives Connection Failed error. How do I connect mysql to my SequelPro / mysql workbench app, is there any configuration I've missed?
Below is the screenshot of my SequelPro connection:
have you tried to access mysql from your local machine with the port defined, in your config is 6603
So whats wrong with this docker-compose.yml? It actually looks ok to me.
But when i try to log in to phpmyadmin on http://localhost:8080/index.php
i get errors:
Packets out of order. Expected 0 received 1. Packet size=71
mysqli_real_connect(): MySQL server has gone away
mysqli_real_connect(): Error while reading greeting packet. PID=33
mysqli_real_connect(): (HY000/2006): MySQL server has gone away
version: "3"
services:
db:
image: mariadb:10.4
volumes:
- test_db_data:/var/lib/mysql
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: test
MYSQL_USER: test
MYSQL_PASSWORD: test
MYSQL_ROOT_PASSWORD: root
networks:
- dbtest
pma:
image: phpmyadmin/phpmyadmin
depends_on:
- db
ports:
- 8080:80
environment:
- PMA_HOST=db
networks:
- dbtest
adminer:
image: adminer
restart: unless-stopped
ports:
- 8081:8080
networks:
- dbtest
volumes:
test_db_data:
networks:
dbtest:
Context:
Docker version 19.03.3
docker-compose version 1.23.2
Update:
I added adminer as well and login also fails.
Mysql stderr shows:
[Warning] Aborted connection 9 to db: 'unconnected' user: 'unauthenticated' host: '192.168.32.3' (This connection closed normally without authentication)
I had the same error and fixed it by deleting the database volume and recreating the database. Not the nicest of solutions. The MySQL server was getting stuck on startup.
I had the luck of it being a database on a dev box so running migrations and reseeding with test data was all I had to do.
Each time when I try to access the phpmyadmin from browser I receive this error:
"Cannot log in to the MySQL server"
I tried to change networks, restart docker.
version: '3'
services:
web:
image: nginx:alpine
ports:
- 80:80
volumes:
- ./public_html:/public_html
- ./conf.d:/etc/nginx/conf.d
networks:
- nginxphp
php:
image: php:7.1.11-fpm-alpine
volumes:
- ./public_html:/public_html
expose:
- 9000
networks:
- nginxphp
db:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: root
ports:
- "3306:3306"
phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: root
MYSQL_PASSWORD: root
depends_on:
- db
ports:
- "8080:80"
networks:
nginxphp:
Cannot log in to the MySQL server
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client
Disclaimer: I'm not a Docker user!
Your didn't mention if you're using the browser on the same computer as the sever or remotely. You'll need access to the mysql server (mysqld) through a terminal (command prompt). If this is a new install, it must be on the computer that is running mysql server.
In the Docker mysql page:
"The default configuration for MySQL can be found in /etc/mysql/my.cnf, which may include additional directories such as /etc/mysql/conf.d or /etc/mysql/mysql.conf.d."
Try looking in the /etc/mysql/my.cnf file on the server you're trying access. first. You're looking for:
bind-address = x.x.x.x
This is the address that the mysql server will talk to ("bound to"). Its typically "localhost" or "127.0.0.1".
To eliminate the error message like you see, I had to do two things:
1) change 'bind-address to 0.0.0.0'
this allows the server to connect to any computer. However, THIS IS A SECURITY RISK. Once you get it working, go read about bind addresses on the mysql website and set it appropriately.
2) Create an new account user#ipaddr where user is the new username and IPAddress is the ip4 address of the computer your trying to connect from. i.e.:
CREATE USER 'user'#'192.168.1.68' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'#'192.168.1.68';
Now try accessing mysql through the terminal program using the new username on the computer with the ip you entered above by typing:
mysql -uuser -ppassword -hx.x.x.x
Hopefully, this will help point you in the right direction. There's a ton of information about bind addresses and security on the web.
Because the phpmyadmin container has connected to the default host localhost. But your mysql server is located in other container (it means you cannot connect to mysql server by using localhost). So in the phpmyadmin service, you have to set PMA_HOST=db. See full env variables: https://hub.docker.com/r/phpmyadmin/phpmyadmin/
Full docker-compose.yml:
version: '3'
services:
web:
image: nginx:alpine
ports:
- 80:80
volumes:
- ./public_html:/public_html
- ./conf.d:/etc/nginx/conf.d
networks:
- nginxphp
php:
image: php:7.1.11-fpm-alpine
volumes:
- ./public_html:/public_html
expose:
- 9000
networks:
- nginxphp
db:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: root
ports:
- "3306:3306"
phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: root
MYSQL_PASSWORD: root
depends_on:
- db
ports:
- "8080:80"
networks:
nginxphp:
If you are using phpmyadmin with latest mysql version you will have some login issues:
Cannot log in to the MySQL server mysqli_real_connect():
The server requested authentication method unknown to the client [caching_sha2_password] mysqli_real_connect(): (HY000/2054):
The server requested authentication method unknown to the client
The solution is to downgrade to mysql 5.7 or another.
I tested with mysql 5.7 and it works for me.
If you want to can test with another versions and let the community know.
Below is the docker-compose file that builds and run Nginx + php 7.1 + mysql 5.7 +phpmyadmin
version: '3'
services:
web:
image: nginx:alpine
ports:
- 80:80
volumes:
- ./public_html:/public_html
- ./conf.d:/etc/nginx/conf.d
networks:
- nginxphp
php:
image: php:7.1.11-fpm-alpine
volumes:
- ./public_html:/public_html
expose:
- 9000
networks:
- nginxphp
db:
image: mysql:5.7
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
phpmyadmin:
image: phpmyadmin/phpmyadmin
links:
- db
environment:
PMA_HOST: db
PMA_PORT: 3306
MYSQL_USER: root
MYSQL_PASSWORD: root
MYSQL_ROOT_PASSWORD: root
depends_on:
- db
ports:
- "8080:80"
networks:
nginxphp:
Hope this will save some time to someone!
I'm pretty new to docker and I guess I have made a proper beginner mistake here but I really can't get my head around of what's wrong...
I have sucesfully created a docker container with a running Wordpress installation. The link to the DB does work there. I can also access phpmyadmin but I can't get in. The following errors appear:
Invalid hostname for server 1. Please review your configuration.
Connection for controluser as defined in your configuration failed.
This is my docker.yml
version: "2"
services:
my-wpdb:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: letmein
my-wp:
image: wordpress
volumes:
- ./:/var/www/html
ports:
- "8080:80"
links:
- my-wpdb:mysql
environment:
WORDPRESS_DB_PASSWORD: letmein
phpmyadmin:
image: corbinu/docker-phpmyadmin
links:
- my-wpdb:mysql
ports:
- 8181:80
environment:
MYSQL_USERNAME: letmein
MYSQL_ROOT_PASSWORD: letmein
I'm trying to log in with: root, letmein
Thank's! Any help appeciated!
Your phpmyadmin is probably trying to connect to mysql using a different hostname from what you expect. (localhost probably?)
In your specific case you need to set it to use my-wpdb, more specifically you want to set that $MYSQL_PORT_3306_TCP_ADDR to point to your database.
From the source code of that (deprecated) docker image is not quite clear, but I'm guessing you need to specify that with
phpmyadmin:
image: corbinu/docker-phpmyadmin
ports:
- 8181:80
environment:
MYSQL_USERNAME: letmein
MYSQL_ROOT_PASSWORD: letmein
MYSQL_PORT_3306_TCP_ADDR: my-wpdb
New to Docker and I'm trying to set up as a development environment on a Drupal 7 project. I'm running into this error when I visit localhost:8080 after running docker-compose up:
Error
The website encountered an unexpected error. Please try again later.
Error messagePDOException: SQLSTATE[HY000] [2002] No such file or directory in lock_may_be_available() (line 167 of /var/www/html/includes/lock.inc).
It looks like it's having an issue connecting to my database. When I run docker ps -a I can see my 2 containers are up and running, so they seem to build just fine. My issue is just connecting my drupal container to the mysql container.
Here is my docker-compose.yml file:
version: '2'
services:
drupal:
image: drupal:7.53-apache
container_name: app
volumes:
- ./:/var/www/html
ports:
- '8080:80'
links:
- mysql
mysql:
image: mysql:5.6.35
container_name: app_db
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: root
MYSQL_PASSWORD: root
MYSQL_DATABASE: testdb
Am I overlooking something else that would connect the two containers? Any and all help is greatly appreciated. Thanks!
try to map the correct ports and the php DATABASE_HOST. for me this works:
db:
image: dev/mysql
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: testdb
MYSQL_USER: root
MYSQL_PASSWORD: root
php:
image: dev/alpine-nginx-php5.6
environment:
DATABASE_HOST: db
ports:
- "80:80"
- "443:443"
volumes:
- ./SRC:/var/www/
links:
- db
but i would suggest to store your database outside of the docker-container. if you have to rebuild or it has a fatal crash everything is deleted.