if you are going to use mysql from another server/IP then you need to provide your location IP where script is hosted but if script is hosted on same server where mysql database is then you will only use localhost.