search
Homephp教程php手册phpmyadmin不需要密码登录的设置方法

phpmyadmin不需要密码登录的设置方法 :

下了最新版的phpmyadmin,装上后输入用户名root然后点登录,因为我在本地,所以root没有密码,结果老是报访问被拒绝的错误.

看了下权限的设置没什么问题呀,网上也没找到好的答案,与是根踪代码,原来在配置文件config.default.php里面有句:

$cfg['Servers'][$i]['AllowNoPasswordRoot'] = false;

在libraries/common.inc.php的886行对他进行了验证,如果他是false的话,用户名如果是root用户,则密码不能为空,否则不进行验证,他默认情况下就是flase,把他改成true就行了.

我想这可能是他为了安全着想吧,让人一定设root密码,呵呵,不过我认为在测试的时候有点不方便,一般本地的root用户都是空的. 

其实他可以把提示语句改下,说是你的root密码为空,以当前的安全级别不允许登录,可以到XXX地方把设置改过来,这样可能会明白些,单一个访问被拒绝太难找原因了.

方法二

./phpmyadmin 进去后在用户权限里面修改,允许空密码登陆.

方法三

默认phpmyadmin空密码登录是被禁止的,这一行为主要通过配置文件libraries/config.default.php中的两个全局变量控制,即代码如下:

$cfg['Servers'][$i]['nopassword'] = false; 
$cfg['Servers'][$i]['AllowNoPassword'] = false;

只要修改这两个变量,设定为True,phpmyadmin就会允许以空密码方式登录,即修改libraries/config.default.php中的代码如下:

$cfg['Servers'][$i]['nopassword'] = true; 
$cfg['Servers'][$i]['AllowNoPassword'] = true;

同时将代码如下:

$cfg['Servers'][$i]['password'] = '';

设置数据库教程连接密码设为空密码,即告成功.

以上就是phpmyadmin不需要密码登录的设置方法 的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment