无法使用容器密码使用MySQL

时间:2019-05-18 08:35:42

标签: mysql docker docker-compose

我已经使用docker创建了mysql容器,但是它不符合设置的密码。

root@5b4f1a35c7b8:/# mysql -uroot -ppassword
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

dockerfile中的代码

  mysql:
    build: ./bin/mysql
    container_name: 'png-mysql'
    restart: 'always'
    ports:
      - "3306:3306"
    volumes:
      - /var/www/docker-compose-lamp/bin/mysql/db:/docker-entrypoint-initdb.d
      - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql
      - ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: x_muti_site
      MYSQL_USER: root
      MYSQL_PASSWORD: password

0 个答案:

没有答案