ER_NOT_SUPPORTED_AUTH_MODE - MySQL server

前端 未结 11 839
旧时难觅i
旧时难觅i 2020-12-02 10:22

I have setup a MySQL database. When I try to access it through my Node JS server, I am getting the error

\"ER_NOT_SUPPORTED_AUTH_MODE: Client does no

11条回答
  •  [愿得一人]
    2020-12-02 11:12

    yellow yow bros !

    // mysql.ts
    const pool = mysql.createPool({
        connectionLimit: 10,
        host: "localhost",
        user: "root",
        password: "password",
        database: "rest-resume-api",
    });
    

    and then I have a docker-compose file such as

    # docker-compose.yml
    
    version: '3.3'
    
    services:
      db:
        image: mysql
        restart: always
        command: --default-authentication-plugin=mysql_native_password
        environment:
          MYSQL_DATABASE: 'rest-resume-api'
          MYSQL_USER: 'root'
          MYSQL_ROOT_PASSWORD: 'password'
        ports:
          - '3306:3306'
        expose:
          - '3306'
        volumes:
          - my-db:/var/lib/mysql2
    volumes:
      my-db:
    
    

提交回复
热议问题