-1

Currently, I am developing an Angular app and I request your help to setup the backend. On my laptop I have installed xampp on "localhost:8080", I have created a mysql database using phpMyAdmin. The php files should be added in the "htdocs" folder right? The angular project should also be added in the "htdocs" folder? If yes, should I run the "ng build" command prior to moving the project to the "htdocs folder"? In the angular app, when the service is used what should be the url in the post and get httpRequests? Should I use "localhost:8080" or "localhost" as hostname when connecting to the database?

1 Answers1

2

Should I use "localhost:8080" or "localhost" as hostname when connecting to the database?

MySQL by default uses 3306 port. So the hostname is localhost and port 3306

Martin
  • 101
  • 6
  • 1
    Better would be ```127.0.0.1:3306```, so you dont need to resolve ```localhost```. – Sebastian Waldbauer Jan 22 '19 at 21:57
  • @SebastianWaldbauer `localhost` doesn't always mean localhost for MySQL. It means "try and connect over the UNIX socket" if that's applicable. The port number is ignored if that's the case. – tadman Jan 22 '19 at 22:08
  • Hes running on Windows so actually it doesnt matter, because TCP/IP is used as default here. [source](https://stackoverflow.com/a/3715946/5802172) – Sebastian Waldbauer Jan 22 '19 at 22:21