I'm having a hard time coming up with a benefit for requiring a password for MariaDB/PHP web apps, since the password will always be stored as plaintext somewhere.
Regardless of whether it's hardcoded in the mysqli_connect() call, or fed to mysqli_connect() from an ENV file or an environment variable or some other location, there doesn't seem to be any security benefit to having a password, since if the webserver can read it, so can anybody that can plant code in the web tree.
It seems like it would be better to set the account to allow password-less login from localhost, then restrict the MariaDB account to the server's IP Address.
Has anybody come up with anything more secure?
Any thoughts?
My Answer:
While it is true that storing passwords in plaintext can pose a security risk, there are still benefits to using a userid/password for mysqli_connect() on a MariaDB/PHP server.
One benefit is that using a password adds an extra layer of security to your database connection. Even if an attacker gains access to the server's filesystem, they would still need the password to connect to the database. This can help prevent unauthorized access to your database.
Additionally, using a password can help protect against insider threats. If someone with access to the server's filesystem decides to misuse their privileges, having a password in place can help prevent them from easily accessing the database.
It is also important to note that there are ways to securely store passwords, such as using encryption or secure password management tools. By implementing proper security measures, you can mitigate the risk of storing passwords in plaintext.
In conclusion, while there are risks associated with storing passwords in plaintext, using a userid/password for mysqli_connect() on a MariaDB/PHP server can still provide security benefits. It is important to implement proper security measures to protect sensitive information and prevent unauthorized access to your database.
Rate this post
3 of 5 based on 3708 votesComments