如何在代码中不写密码来使用mysql? [英] how to not write password in code for using to mysql?

查看:182
本文介绍了如何在代码中不写密码来使用mysql?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hallo,

我使用PHP而且我不想用硬编码方式写密码

并登录访问mysql。

如何在代码中不写密码来访问mysql?

我该怎么办?

我想看看我的代码看不到的人我的口号。

有解决方案吗?

提前谢谢。

马里奥。

hallo,
I use PHP and I''d like to not write in hardcoded way password
and login to access to mysql.
how to not write password in code for access to mysql?
How can I do?
I''d like that who see my code don''t see my paswords.
there is a solution?
Thank you in advance.
Mario.

推荐答案

_mario.lat写道:
_mario.lat wrote:

我使用PHP而且我不想用硬编码方式写密码

并登录访问mysql。

如何在代码中不写密码才能访问mysql?

我该怎么办?

我想看到我的代码看不到我的密码。

有解决方案吗?
I use PHP and I''d like to not write in hardcoded way password
and login to access to mysql.
how to not write password in code for access to mysql?
How can I do?
I''d like that who see my code don''t see my paswords.
there is a solution?



我假设你为你的服务器使用类Unix系统。


我假设你的PHP脚本在〜/ public_html


然后你可以创建一个目录〜/ mypasswords


现在你可以创建以下文件


---〜/ mypasswords / mysql.log.data.php ---

<?PHP

I assume you use a Unix like system for your server.

I assume you have your PHP scripts in ~/public_html

Then you can create a directory ~/mypasswords

Now you can create the following file

--- ~/mypasswords/mysql.log.data.php ---
<?PHP


mysql_login =" ; loginname" ;;
mysql_login="loginname";


mysql_passw =" secretpass";
mysql_passw="secretpass";


这篇关于如何在代码中不写密码来使用mysql?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆