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?
Asked
Active
Viewed 228 times
-1
-
out of curiosity. Why are you using php and mysql? instead of NodeJS and mongoDB? – Patricio Vargas Jan 22 '19 at 22:09
-
@TAMOStudio i have a hosting account on hostgator.com who only have mysql and phpMyAdmin – raffi kasbarian Jan 26 '19 at 07:31
1 Answers
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
-
1Better 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