0

I have my node server to run on port 3306 and whenever I try to run it their is a process running on the same port. After running the command lsof -t -i :3306 I can see that mysql is running. I then run the command mysqladmin -u root -p shutdown and it says that mysql has shutdown successfully. I then try to run my node server but I keep getting the errr Address in use. I check again and see the mysqld process running. I keep killing but it doesn't stop. How can I kill it and stop from coming back?

Mohamed Ali
  • 702
  • 8
  • 29
  • 3
    There's probably a service to stop. Something like `/etc/init.d/mysql stop` or the like. Restarting will probably bring it back, too. Why on *earth* would you want to run a Node app on 3306, though? That's just asking for trouble (like this!). – ceejayoz Oct 26 '18 at 17:58
  • I am using a mac so i dont see `/etc/init.d/` – Mohamed Ali Oct 26 '18 at 19:12
  • Then consult https://stackoverflow.com/questions/100948/how-do-you-stop-mysql-on-a-mac-os-install. – ceejayoz Oct 26 '18 at 19:22

1 Answers1

0

You could:

  • Stop the MySQL service in Windows Task Manager(ctrl + alt+del then services) or on Services.msc (windows key + r , then type services.msc)

  • uninstall MySQL in the computer (if you don't need it anymore)

  • as user @ceejayoz said, make your node.js app/webserver listen to a different port so you don't have to do the above. If you're using Express.js port 3000 is good if you don't need elevated privileges

Malcolm Salvador
  • 1,476
  • 2
  • 21
  • 40
  • I have my react application listening on 3000 and node listening on 3306. – Mohamed Ali Oct 26 '18 at 19:11
  • How about 8000? – Malcolm Salvador Oct 26 '18 at 19:34
  • 1
    @moeeli Or pretty much any port not already on the list in https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers. 3001, 3002, 3003 are all open for use. 3005-3019, 3021-3049, etc. etc. etc. Picking a commonly used one (and one that'll commonly be used by a Node app) is a little insane. :-D – ceejayoz Oct 26 '18 at 20:18