Dotnet app can not connect to mysql inside docker, but mysql is available outside docker

I have a simple dotnet app fresh template using mysql as database.

I tried adding docker on my project but for some reason im getting this error inside my dotnet container:

Error:

Unhandled exception. System.AggregateException: One or more errors occurred. (Unable to connect to any of the specified MySQL hosts.)
MySqlConnector.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.

but when I try to connect mysql using tableplus (DBMS) its working fine.
image
heres my connection string:

"DefaultConnection": "Server=localhost;Port=3306;Database=lgu_hr;Uid=development;Pwd=development;"

heres my Dockerfile: (this is generated by rider IDE)

FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
EXPOSE 5132

FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["LGU-HR-Web/LGU-HR.csproj", "LGU-HR-Web/"]
RUN dotnet restore "LGU-HR-Web/LGU-HR.csproj"
COPY . .
WORKDIR "/src/LGU-HR-Web"
RUN dotnet build "LGU-HR.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "LGU-HR.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "LGU-HR.dll"]

Heres my compose.yml

name: LGU_HR_APP

services:
  lgu-hr:
    image: lgu-hr
    container_name: lgu_hr_app
    restart: always
    build:
      context: .
      dockerfile: LGU-HR-Web/Dockerfile
    ports:
      - "5132:5132"
    environment:
      ASPNETCORE_ENVIRONMENT: Development
    depends_on:
      - db
    networks:
      - app_network

  db:
    image: mysql:8
    container_name: lgu_hr_app_db
    restart: always
    environment:
      MYSQL_USER: development
      MYSQL_PASSWORD: development
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: lgu_hr
    ports:
      - "3306:3306"
    volumes:
      - data:/var/lib/mysql
    

volumes:
  data:
    
networks:
  app_network:

I tried changing server connectionString localhost, 127.0.0.1, db, host.docker.internal, 172.18.0.1 (this is from mysql container Gateway)

Also when inspecting inside mysql container that I can confirm development@localhost is present.

I also tried going inside the dotnet app container and running .dll and confirm that it cant connect to mysql.

I also opened page 2 of google and still got no answer.

any suggestion would be great Christmas gift.