MySql

I am quiet new to Cpanel and webhosting. I have came across several question, from which many of them occurred since i dont have much experience.

So my problem is that, on localhost i have created a database with some applications, and its working nicely, however, when i upload it to the server, i cant use it, and i cant connect to my database what i have made.

this is nicely working on localhost, but not on the server, how should i modify the coding that will work online? I think i need to write something instead of localhost, but i dont know what it should be.

First of all you will have to create the database from your cPanel and then need to create the database user to gain access to the particular database and then try to connect your database. If you still fail then try to use the IP address of your MySQL server replace to localhost and have a try.