关键词:
【中文标题】无法使用 root 和无密码登录 phpmyadmin【英文标题】:Can't log into phpmyadmin using root and no password 【发布时间】:2017-05-18 21:06:39 【问题描述】:我正在使用 ubuntu,我使用this 方式安装我的 php 和 mysql。 当 mysql 询问我密码时(几次),我总是让它为空并点击“确定”。 现在的问题是我无法登录 phpmyadmin。 我尝试了一些在这个网站上找到的方法,并得到了这样的配置。
<?php
/**
* Debian local configuration file
*
* This file overrides the settings made by phpMyAdmin interactive setup
* utility.
*
* For example configuration see
* /usr/share/doc/phpmyadmin/examples/config.sample.inc.php
* or
* /usr/share/doc/phpmyadmin/examples/config.manyhosts.inc.php
*
* NOTE: do not add security sensitive data to this file (like passwords)
* unless you really know what you're doing. If you do, any user that can
* run PHP or CGI on your webserver will be able to read them. If you still
* want to do this, make sure to properly secure the access to this file
* (also on the filesystem level).
*/
if (!function_exists('check_file_access'))
function check_file_access($path)
if (is_readable($path))
return true;
else
error_log(
'phpmyadmin: Failed to load ' . $path
. ' Check group www-data has read access and open_basedir restrictions.'
);
return false;
// Load secret generated on postinst
if (check_file_access('/var/lib/phpmyadmin/blowfish_secret.inc.php'))
require('/var/lib/phpmyadmin/blowfish_secret.inc.php');
// Load autoconf local config
if (check_file_access('/var/lib/phpmyadmin/config.inc.php'))
require('/var/lib/phpmyadmin/config.inc.php');
/**
* Server(s) configuration
*/
$i = 0;
// The $cfg['Servers'] array starts with $cfg['Servers'][1]. Do not use $cfg['Servers'][0].
// You can disable a server config entry by setting host to ''.
$i++;
/**
* Read configuration from dbconfig-common
* You can regenerate it using: dpkg-reconfigure -plow phpmyadmin
*/
if (check_file_access('/etc/phpmyadmin/config-db.php'))
require('/etc/phpmyadmin/config-db.php');
/* Configure according to dbconfig-common if enabled */
if (!empty($dbname))
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
if (empty($dbserver)) $dbserver = 'localhost';
$cfg['Servers'][$i]['host'] = $dbserver;
if (!empty($dbport) || $dbserver != 'localhost')
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['port'] = $dbport;
//$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysqli';
/* Optional: User for advanced features */
$cfg['Servers'][$i]['controluser'] = $dbuser;
$cfg['Servers'][$i]['controlpass'] = $dbpass;
/* Optional: Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = $dbname;
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
/* Uncomment the following to enable logging in to passwordless accounts,
* after taking note of the associated security risks. */
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
/* Advance to next server for rest of config */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Uncomment the following to enable logging in to passwordless accounts,
* after taking note of the associated security risks. */
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
/**
* phpMyAdmin configuration storage settings.
*/
/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Storage database and tables */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma__relation';
// $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
// $cfg['Servers'][$i]['history'] = 'pma__history';
// $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
// $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
// $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
// $cfg['Servers'][$i]['recent'] = 'pma__recent';
// $cfg['Servers'][$i]['favorite'] = 'pma__favorite';
// $cfg['Servers'][$i]['users'] = 'pma__users';
// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
// $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
// $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
// $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
// $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
// $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';
/*
* End of servers configuration
*/
/*
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
/* Support additional configurations */
foreach (glob('/etc/phpmyadmin/conf.d/*.php') as $filename)
include($filename);
但 phpmyadmin 仍然总是要求登录,我在尝试登录但未填写密码 #1698 - Access denied for user 'root'@'localhost'
时也会收到此错误消息。
我可以访问 mysql 的唯一方法是使用sudo mysql -u root
。
但是,我的期望不是只可以登录phpmyadmin,而是通过登录页面无需登录即可访问phpmyadmin。
【问题讨论】:
您是否在 phpMyAdmin 中启用了 root 登录?在 config.inc.php 文件中:$cfg['Servers'][$i]['AllowRoot'] = TRUE; 您也可以尝试在 $cfg['Servers'][$i]['host'] = 'localhost' 中将 'localhost' 替换为 '127.0.0.1'; 最后但同样重要的是,尝试设置 $cfg['Servers'][$i]['AllowNoPassword'] = TRUE; (见docs.phpmyadmin.net/fr/latest/…) 我尝试了你所说的,但它给了我相同的结果。 #1698 - 用户 'root'@'localhost' 的访问被拒绝 哦 :/ 但是等等,我明白了,查看这篇文章:askubuntu.com/questions/763336/…。 MySQL 5.7 无法以 root 身份登录 phpMyAdmin,但接受的答案提供了一种解决方法。 【参考方案1】:去终端
sudo ls /etc/phpmyadmin
输入你的密码 sudo sudo vi /etc/phpmyadmin/config.inc.php
然后将评论从 Allownopassword 删除为 TRUE 在编辑器末尾使用插入 然后转义:x
【讨论】:
无法使用 root 用户登录 phpmyadmin
】无法使用root用户登录phpmyadmin【英文标题】:Cannotlogintophpmyadminwithrootuser【发布时间】:2018-11-0208:14:51【问题描述】:我无法在Ubuntu系统中使用phpmyadmin登录。用户名-根密码-空但它仍然显示如下错误#1045-Accessdeniedforuser\'root\'@\'lo... 查看详情
没有密码就无法以root身份登录phpmyadmin [关闭]
】没有密码就无法以root身份登录phpmyadmin[关闭]【英文标题】:Cantloginasrootwithnopasswordtophpmyadmin[closed]【发布时间】:2011-12-0722:41:00【问题描述】:这是我的config.inc.php文件,因为我突然升级到11.10,我无法在没有密码的情况下以roo... 查看详情
mysql8.0密码正确但是无法登录直接提示我密码错错误
...事。难道不是密码的问题??????MySQL8.0密码正确但无法登录。我直接提示我的密码错误,因为密码设置不正确。我需要重置密码。设置方法是:1,首先进入phpmyadmin管理后台。2,然后,点击顶部 查看详情
更改root密码后PHPMyAdmin无法连接
】更改root密码后PHPMyAdmin无法连接【英文标题】:PHPMyAdmindoesn\'tconnectafterrootpasswordchange【发布时间】:2012-10-1204:39:35【问题描述】:我安装了Xampp(适用于Windows)。我很高兴使用它的所有功能。然后我想更改MySql密码。我设置了... 查看详情
linux无法登录系统,我用root用户登录,密码肯定是对的但是一直提示登录失败,
我进入single模式重新创建用户,也登录不了,就指教,也修改了/etc/pam.d/login下的还是不行,各位有何高见你是远程还是本地,远程有时候是关闭ROOT远程登录了,本地账号密码正确不可能登录不上,参考技术Aroot可能在默认的时... 查看详情
centos7root密码正确但是无法远程登录
参考技术Atail-f/var/log/messages发现Userrootfrom192.168.3.202notallowedbecauselistedinDenyUsersvi/etc/ssh/sshd_config删除DenyUsersroot一行,重启sshd服务 查看详情
ubuntu系统如何使用root用户登录
Ubuntu系统如何使用root用户登录实例?Ubuntu系统的默认用户名是ubuntu,并在安装过程中默认不设置root帐户和密码。您如有需要,可在设置中开启允许root用户登录。具体操作步骤如下:使用ubuntu帐户登录轻量应用服务器。执行以下... 查看详情
配置中定义的 controluser 连接失败。 #1045 无法登录 MySQL 服务器
...mpp。之前,我可以使用我的用户名和密码轻松登录到我的phpmyadm 查看详情
ubuntu系统怎么使用root用户登录
...:suroot。然后输入密码:发现可以切换到root权限了。4、使用suxyx命令,切换到普通用户。完成。 查看详情
如何进入linux中的root账户
使用root用户登录,然后中断输入cd即可到root目录。使用终端可以使用su-登录root,如果是图形界面可以注销登录时选择其他,输入root,输入密码登录,如果不允许root登录,按如下步骤设置:1.用普通用户登录。2.在终端执行sudo-s... 查看详情
ubuntu安装时没注册root用户密码,怎么登录root
...用root登陆图形界面提示"抱歉,认证失败,请重试,无法登陆图形界面。二、设置root用户登陆图形界面。1.在桌面空白处点击右键菜单"打开终端"。2.运行命令"sudovi/etc/pam.d/gdm-autologin"。3.注释行"authrequiedpam_s... 查看详情
ubuntu安装时没注册root用户密码,怎么登录root
...用root登陆图形界面提示"抱歉,认证失败,请重试,无法登陆图形界面。二、设置root用户登陆图形界面。1.在桌面空白处点击右键菜单"打开终端"。2.运行命令"sudovi/etc/pam.d/gdm-autologin"。3.注释行"authrequiedpam_s... 查看详情
MariaDB - 无法以 root 身份登录
】MariaDB-无法以root身份登录【英文标题】:MariaDB-cannotloginasroot【发布时间】:2017-09-0820:17:37【问题描述】:我正在尝试在Ubuntu(16.04.02)上设置MariaDB(10.0.29)。在我安装它并启动进程(sudoservicemysqlstart)后,即使我最初将密码设置为空... 查看详情
debian9.5解决在root用户下启用vnc后lightdm+xfce4只能使用root登录,其他用户无法登陆
...root用户下启用VNC后lightdm+Xfce4只能使用root登录,其他用户无法登陆最近在研究debian9.5VNC的问题,当VNC使用tightVNC或tigerVNC软件时候,在root用户下通过命令vncserver启动vnc服务后会遇到进入桌面的时候,使用root可以进入XFCE桌面,使... 查看详情
phpMyAdmin,无法登录到root用户
】phpMyAdmin,无法登录到root用户【英文标题】:phpMyAdmin,cannotlogintorootuser【发布时间】:2017-02-0703:03:44【问题描述】:我刚刚在我的服务器上设置了一个LEMP堆栈,然后我安装了phpMyAdmin。由于root用户用于连接的方法,我似乎无法... 查看详情
ubuntukeylin14.04怎么使用root用户登录
...Ubuntukeylin14.04方法/步骤1为root用户设置密码安装完成如需使用root身份登录,可打开终端输入以下命令:#设置root密码sudopasswdroot输入当前用户密码,然后输入两次设置的root密码;Ubuntukeylin14.04如何开启root用户登录2#切换到root用户s... 查看详情
如何解决linux下通过root无法远程登录
参考技术A发现问题通过xshell连接ubuntu,输入,连接名称,ip,端口,已经用户名密码,输入完成后点击连接,开始进行远程连接,发现一直提示连接不了;提示"ssh服务器拒绝了密码,请再试一次。"其实试了多少次都没用... 查看详情
如何进入linux中的root账户
...录系统,然后从终端用suroot操作进入root用户。参考技术A使用终端可以使用su-登录,如果是图形界面可以注销登录时选择其他,输入root,输入密码登录,如果不允许root登录,按如下步骤设置:1.用普通用户登录。2.在终端执行sudo... 查看详情