简体   繁体   English

PHP如何从mysql_connect()获取mysql用户名和密码

[英]PHP how to get mysql username and password from mysql_connect()

is there any way to get host , username and password from mysql_connet("localhost","abc","***") . 有没有办法从mysql_connet("localhost","abc","***")获取hostusernamepassword For some other reason i don't want to assign variable for password. 由于其他原因,我不想为密码分配变量。

For some other reason i don't want to assign variable for password. 由于其他原因,我不想为密码分配变量。

You can use the INI settings mysql.default_user and mysql.default_password . 您可以使用INI设置mysql.default_usermysql.default_password See this manual entry . 请参阅此手册条目

No way to get back host / username / password, once you have made connection. 一旦建立连接,就无法取回主机/用户名/密码。 if you don't want to assign password by using variable use mysql.default_password string which is use when connecting to the database server if no other password is specified. 如果您不想使用变量分配密码,请使用mysql.default_password字符串,如果未指定其他密码,则在连接到数据库服务器时使用字符串。 specified in php.ini file. 在php.ini文件中指定。

Warning: any user with read access to php.ini file can reveal the password. 警告:对php.ini文件具有读访问权限的任何用户都可以显示密码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM