php 任何人都可以确认 phpMyAdmin AllowNoPassword 适用于 MySQL 数据库吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5908752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 22:51:13  来源:igfitidea点击:

Can anyone confirm that phpMyAdmin AllowNoPassword works with MySQL databases?

phpmysqlapachepasswordsphpmyadmin

提问by diggersworld

I have a version of phpMyAdmin located on my local Apache server.

我的本地 Apache 服务器上有一个 phpMyAdmin 版本。

I am trying to login without a password however phpMyAdmin keeps throwing the warning:

我试图在没有密码的情况下登录,但是 phpMyAdmin 不断抛出警告:

Login without a password is forbidden by configuration (see AllowNoPassword)

配置禁止无密码登录(见 AllowNoPassword)

However in my config.phpfile for phpMyAdmin I have set:

但是,在phpMyAdmin 的config.php文件中,我设置了:

$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

So I don't know why the message is still appearing.

所以我不知道为什么消息仍然出现。

回答by DondeEstaMiCulo

  1. Copyconfig.sample.inc.phpto config.inc.php.

    In most cases you will find the config file

    • on linux: /etc/phpmyadmin/config.inc.php
    • on mac: /Library/WebServer/Documents/phpmyadmin/config.inc.php
  2. If you are trying to log in as root, you should have the following lines in your config:

    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['AllowNoPassword'] = true;

  1. 复制config.sample.inc.phpconfig.inc.php.

    在大多数情况下,您会找到配置文件

    • 在 Linux 上: /etc/phpmyadmin/config.inc.php
    • 在 Mac 上: /Library/WebServer/Documents/phpmyadmin/config.inc.php
  2. 如果您尝试以 root 身份登录,则您的配置中应该包含以下几行:

    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['AllowNoPassword'] = true;

回答by Malintha

According to this: https://www.simplified.guide/phpmyadmin/enable-login-without-password

根据这个:https: //www.simplified.guide/phpmyadmin/enable-login-without-password

This $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;should be added twice in /etc/phpmyadmin/config.inc.php

$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;应该添加两次/etc/phpmyadmin/config.inc.php

if (!empty($dbname)) {
    // other configuration options
    $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
    // it should be placed before the following line
    $i++;
}

// other configuration options
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

回答by Orion

I tested the statement:

我测试了语句:

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

It did not work out for me.

它对我不起作用。

Instead

反而

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

worked.

工作。

Thanks!

谢谢!

回答by Pratik Bothra

You might have made the same silly mistake that I did, by not removing the // making it a comment.

你可能犯了和我一样的愚蠢错误,没有删除 // 使其成为注释。

The line should be like this, but not as a comment.

该行应该是这样的,但不是作为注释。

$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

回答by Nanhe Kumar

Make sure you don't add or uncomment the AllowNoPassword option after the $i++ line.

确保不要在 $i++ 行之后添加或取消注释 AllowNoPassword 选项。

/* Uncomment the following to enable logging in to passwordless accounts, * after taking note of the associated security risks. */

/* 在注意相关的安全风险后,取消注释以下内容以启用登录无密码帐户*。*/

 $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

回答by Aldy syahdeini

I have the same problem here, then I reinstalled mysqland it worked.

我在这里遇到了同样的问题,然后我重新安装了mysql它,它起作用了。

sudo apt-get install mysql-server mysql-common mysql-client

回答by Manish Shrivastava

Just in file /etc/phpmyadmin/config.inc.php, uncomment or add the line(if not there),

就在 file 中/etc/phpmyadmin/config.inc.php,取消注释或添加该行(如果没有),

$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

It works just Awesome!

它的工作原理真棒!

if you have any doubt restart apache.

如果您有任何疑问,请重新启动 apache。

sudo /etc/init.d/apache2 restart

Cheers!!!

干杯!!!

回答by zheek

I had a same problem, and I solved my problem.
First go to config.default.phpand change

我有同样的问题,我解决了我的问题。
先去config.default.php

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

to

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

回答by lakshmikandan

$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

yes the above answer is correct, but it's not secure, you can login root userdirectlyinto phpMyAdmin.

是的,上面的答案是正确的,但它不安全,您可以直接以root 用户登录phpMyAdmin

If you want to create new user with password and give grant permission, execute the below command in MySQL on terminal, Login into your server on terminal,

如果要使用密码创建新用户并授予权限,请在终端上的 MySQL 中执行以下命令,在终端上登录到您的服务器,

  # mysql

 mysql> GRANT ALL PRIVILEGES ON *.* TO  'user-name'@'%'  IDENTIFIED BY  'password'   REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;

回答by ismail

After a lot of trials I found the following solution.

经过大量试验,我找到了以下解决方案。

This will work if you copied all phpmyadmin files in /var/www

如果您将所有 phpmyadmin 文件复制到 /var/www 中,这将起作用

go to your copied location of phpmyadmin folder in /var/www

转到 /var/www 中 phpmyadmin 文件夹的复制位置

copy the config.sample.inc.php file as config.inc.php

edit in config.inc.php the following line:

在 config.inc.php 中编辑以下行:

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

(In original file it was false, change it as true and save it.)

(在原始文件中它是假的,将其更改为真并保存。)

Then you will be able to login phpmyadmin without password.

然后你就可以不用密码登录phpmyadmin了。