1

Using wordpress/mariadb docker image I want to install wordpress locally with the following default settings,

DB_NAME: mysite_wp
DB_USER: myuser
DB_PASSWORD: mypw
DB_HOST: localhost

Using the docker-componse.yml file

version: '2'

services:

  wordpress:
    image: wordpress
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_NAME: mysite_wp
      WORDPRESS_DB_USER: myuser
      WORDPRESS_DB_PASSWORD: mypw
    volumes:
      - ./src:/var/www/html

  mysql:
    image: mariadb
    environment:      
      MYSQL_ROOT_PASSWORD: mypw
      MYSQL_USER: myuser
      MYSQL_PASSWORD: mypw
    volumes:
      - ./db/mysite_wp.sql:/docker-entrypoint-initdb.d/mysite_wp.sql

I am getting error

wordpress_1  | MySQL Connection Error: (1045) Access denied for user 'myuser'@'172.18.0.3' (using password: YES)
coure2011
  • 40,286
  • 83
  • 216
  • 349
  • Make sure you have correctly granted the required privileges of the database to the user – Amin Nov 29 '16 at 19:08
  • how to do that? – coure2011 Nov 30 '16 at 03:52
  • check this : http://stackoverflow.com/questions/5016505/mysql-grant-all-privileges-on-database and this : http://dev.mysql.com/doc/refman/5.7/en/grant.html – Amin Nov 30 '16 at 07:23
  • Go to mysql command-line and login as root ( `mysql -u root -p` ) and then do the grant permission stuff ( `GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost';` – Amin Nov 30 '16 at 07:58
  • and if you have phpmyadmin installed it gets easier , just create a database and then go to PRIVILEGES tab then create a user and check all PRIVILEGES and save it – Amin Nov 30 '16 at 08:03

0 Answers0