Database information inside the client

Hello to everybody.
I was trying to make an online game and today I was trying to do a login system.
Every guide uses db connection trough the client and not the server.
For example: the db info like:
db name
db username
db pass
Are stored in a blueprint inside the client and not inside the server script (as I though to do).
In this way isn’t there the possibility the somebody can leak the client stoling the db infos?

EDIT:
What I to want to do is to make a direct “speaking” between server and database in this way:
Client ask to server.
Server convert to sql query.
Server ask to db.
Db reply to server.
Server convert to client.
Client show results.
I searched around google and I found that a lot of people speak about php scripts (but why that?) or using the VaRest plugin. What should I do?