哪里存储mysql用户名和密码 [英] Where to store mysql username and password

查看:2369
本文介绍了哪里存储mysql用户名和密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

我正在使用MySQL数据库在PHP中开发一个网站.

当我连接到MySQL数据库时,我需要提供用户名和密码.
我想知道该密码和用户名应该存储在哪里,以便当我需要提供用户名和密码时,可以从该位置检索它.

我想保护我的用户名和密码.

Dear Friends,

I am developing a website in PHP using MySQL Database.

When I connect to MySQL database, I need to give the username and password.
I want to know that where should I store this password and username, so that when I need to give the username and password, I retrieve it from that place.

I want to secure my username and password.

推荐答案

您可以编写一个仅包含MySQL连接详细信息的php文件,并将其存储为connection.php.然后,您可以将其包含在需要使用
连接到数据库的每个php文件中
You can write a php file with just MySQL connection detail and store it as connection.php. And then you can include it in every php file that requires to connect to the DB using the

<?php require_once("connection.php")<br mode="hold" /?>



您可以利用



You can make use of

<?php include("connection.php")<br mode="hold" /?>


也是,但这可能会由于连接错误太多而出错.

由于无法以txt模式从浏览器读取脚本,因此您也不必担心安全性问题.

BR//
Harsha


too but this might error out some time with Too many connection error.

As the scripts are not readable from the browser in txt mode you don''t have to worry about the security issues too.

BR//
Harsha


在数据库中创建表
存储您的用户名和密码,以及是否需要安全性
那么您需要先对密码进行加密,然后再将其存储到数据库中
并且在检索该密码时,您需要解密该密码.
create a table in the database
store your user Name and password and if you want security
then you need to encrypt your password before storing it into the Database
and at the time of retrieving that password you need to decrypt that.


此讨论应为您提供指导: ^ ]

您需要加密用户名/密码,并将其存储在数据库或一些可访问的配置/文本文件中.
This discussion should give you a direction: Similar topic discussed[^]

You need to encrypt the username/password and store it in database or some config/text file accessible.


这篇关于哪里存储mysql用户名和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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