Fix "bind: address already in use" error by finding the process in use and stopping it.
Example error message:
$ my_command 2019/04/24 17:09:14 listen tcp 127.0.0.1:3306: bind: address already in use
Stop the process using port 3306:
$ sudo kill $(sudo lsof -t -i:3306)
Clear the port, by finding the process using the port.
For example, find a process using port 8000.
$ netstat -tulpn | grep 8000
Running the netstat command will show an id on the far right. Stop the process by passing this process id to the kill command.
For example, if the id was 3746, run the following command.
$ kill 3746