Can't connect to MySQL server on 'localhost'

I start a new phoenix with --database mysql on my MBP, after I install the deps, the command mix ecto.create said The database for PhoenixChat.Repo couldn't be created: ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost', but we I run this repo on remote server, it works, werid, anybody have issue like this? thanks

Are you running a local MySQL server with the proper port and such information?

1 Like

Check that port 3306 is being listened in your computer.

You can run the following command on mac to get that result:
lsof -n -i4TCP:3306 | grep LISTEN

If not (empty result), Then MySql is not running properly.
If it exists there might be something wrong either your Repo config or MySql bindings.