配置数据库信息 :

vim config/dev.exs

与本地数据库或者docker的数据库进行连接例如这样:

# Configure your database
config :lueluelue_backend, LueLueLueBackend.Repo,
  username: "admin",
  password: "88888888",
  hostname: "localhost",
  database: "lueluelue_backend",
  stacktrace: true,
  show_sensitive_data_on_connection_error: true,
  pool_size: 10
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with esbuild to bundle .js and .css sources.
config :lueluelue_backend, LueLueLueBackendWeb.Endpoint,
  # Binding to loopback ipv4 address prevents access from other machines.
  # Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
  http: [ip: {127, 0, 0, 1}, port: 4000#(启动server的端口)],
  check_origin: false,
  code_reloader: true,
  debug_errors: true,
  secret_key_base: "JpP+ld/4ErLPTtDmg+biACvp2Oc152hAOB0Qz6UpDtNgSFQ8RL+UYxNeo69hoByl",
  watchers: [
    # Start the esbuild watcher by calling Esbuild.install_and_run(:default, args)
    esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]}
  ]

启动server:

mix phx.server

打开浏览器