How to add Magento 2 Docker phpmyadmin image in docker-compose.yml file?

You can add the PHPMyAdmin image snippet in the docker-compose YAML file that looks like below code snippet.

In Docker instance,

version: '3.0'
services:
  phpmyadmin:
    image: 'phpmyadmin/phpmyadmin:latest'
    environment:
      - PMA_HOST=<hostname>
      - PMA_USER=<db_user>
      - PMA_PASSWORD=<password>
    ports:
      - "8080:80"
    volumes:
      - /sessions
    networks:
      magento:
        aliases:
          - 'phpmyadmin.magento2.docker'

Using this code, you can directly access the phpmyadmin database from the browser.

For Warden,

php-fpm:
    ports:
            - "4000:4000"
            - "3001:3001"
    phpmyadmin:
        restart: always
        image: docker.io/library/phpmyadmin:latest
        hostname: ${WARDEN_ENV_NAME}-phpmyadmin
        domainname: phpmyadmin.${WARDEN_ENV_NAME}.test
        ports:
            - 8100:80
        environment:
            - PMA_HOSTS=${WARDEN_ENV_NAME}_db_1
            - PMA_USER=magento
            - PMA_PASSWORD=magento
            - PMA_ABSOLUTE_URI=http://phpmyadmin.${TRAEFIK_DOMAIN}

ERROR 1273 (HY000) at line 4048: Unknown collation: ‘utf8mb4_0900_ai_ci’ at Database import time.

I have just started to import the database using the warden command,

warden db import < project.sql

I am not able to import the Database using the above command and throws an error, Continue reading “ERROR 1273 (HY000) at line 4048: Unknown collation: ‘utf8mb4_0900_ai_ci’ at Database import time.”

How to set current time for timestamp and datetime type in magento object save repository?

Timestamp and DateTime type of MySQL is used to set date and date/time value to the database table.

Both types contain the default attribute called default=”CURRENT_TIMESTAMP” to use the set current time in the table.

While you are working with the db_schema.xml file and need to add/update the current time in the table for any specific object save repository, you can set the default attribute with the value CURRENT_TIMESTAMP to save current time while placing an entry in the database table. Continue reading “How to set current time for timestamp and datetime type in magento object save repository?”