1

Say I have the mysql credentials

username: mysqlusername

password: letmein

In my code somewhere, I'm going to have to establish a connection to my database using these credentials.

However, if I'm using a public repository (e.g. github), I don't want to have a line of code that says

mysql_connect("localhost","mysqlusername","letmein","my_db");

because then anybody could see these credentials.

What is the best way to hide these credentials, while still having all my code in a public repository?

Community
  • 1
  • 1
jros
  • 714
  • 1
  • 10
  • 33
  • This is not so much on mysql or repositories but rather about the programming language/environment you are using. I suppose it is python? Generally, you can ask the creds interactively from the user or set it as runtime argument when launching the application. – Würgspaß Oct 07 '15 at 16:06
  • 2
    Possible duplicate of [How to secure database passwords in PHP?](http://stackoverflow.com/questions/97984/how-to-secure-database-passwords-in-php) – Neil McGuigan Oct 07 '15 at 18:27
  • Store the credentials in O/S environment variables. – Neil McGuigan Oct 07 '15 at 18:27

0 Answers0