Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

500
Views
mySQL error Access Denied from Server run by Docker Container

I am very new to programming and have been tasked to run an app through a docker container using mySql server. I have been unable to connect to the server (although the server is showing running in docker desktop). The error message I keep receiving via the terminal after going through the procedure is:

code: 'ER_ACCESS_DENIED_ERROR',
  errno: 1045,
  sqlState: '28000',
  sqlMessage: "Access denied for user ''@'localhost' (using password: YES)"

I am using MacOS Big Sur, with Docker Desktop Version 4.7.1, mySql Server version: 8.0.28 Homebrew, npm and nodejs.

Procedure being run in the terminal after cloning remote repo files into my local environment:

docker pull mysql/mysql-server
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=<123456> -e MYSQL_DATABASE=flash_card mysql:5.7
name=$(docker inspect --format="{{.Id}}" mysql)
docker exec -i $name mysql --user=root --password=<123456> "flash_card" < dbschema.sql
npm install
node index.js # **Error occurs here**

The Docker Desktop shows the mySql server is running. When attempting to open the connection through the browser, the following error occurs:

This page isn’t working. localhost sent an invalid response.
ERR_INVALID_HTTP_RESPONSE

I tried mysql -u root -p and changing my password and flushing privileges. Restarting the SQL server. Still no luck. I do not have SQL workbench installed and would like a solution that can be done through the docker container mySQL image via the command terminal. If there is a solution through SQL workbench that would be appreciated as well.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!