【问题标题】:phpMyAdmin Connection for controluser as defined in your configuration failed配置中定义的 controluser 的 phpMyAdmin 连接失败
【发布时间】:2016-01-27 08:44:02
【问题描述】:

所以,今天我第一次在 Ubuntu 15.10 上安装了 XAMPP/LAMPP。 Apache 服务器工作正常,但是当我尝试转到“localhost/phpmyadmin”时,出现以下错误:

相信我,我搜索了整个互联网、堆栈溢出、apache 朋友等,但没有一个给定的解决方案对我有用......所以这是我的 config.inc.php 文件:

<?php
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie'; 
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
/* Server parameters */
//$cfg['Servers'][$i]['host'] = 'localhost';
//$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$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'] = '';

/* 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';

所以你可以看到我的用户 = root 和密码是空的。但这根本行不通,我尝试更改用户/密码,尝试更改 controluser 和 controlpass,但似乎没有任何效果。你知道我该如何解决这个问题吗?

【问题讨论】:

  • 您是否有一个没有密码的用户“pma”,在这个 MySQL 服务器中定义?因为您的配置要求 phpMyAdmin 尝试与此类用户建立连接。
  • 不,我没有在 MySQL 服务器中定义任何东西?你能解释一下我该怎么做吗?
  • 在下面查看我的新答案。

标签: phpmyadmin


【解决方案1】:
sudo chown -R mysql:mysql /var/lib/mysql 

为我工作。

【讨论】:

    【解决方案2】:

    首先注释掉 config.inc.php 中的 controluser 和 controlpass 行。然后您就可以使用 root 登录,并使用“权限”或“用户帐户”菜单添加此 pma 用户。在documentation中有解释。

    【讨论】:

    • 当我在 config.inc.php 中注释掉 'controluser' 和 'controlpass' 并尝试以 root 身份登录时,“配置中定义的 controluser 连接失败”错误消失但“无法登录进入 MySQL 服务器”。
    • 这意味着你没有正确的登录信息,或者MySQL服务器没有运行。
    • 好吧,我没有从 XAMPP 管理器运行 MySQL 服务器。谢谢你的回答,你是传奇。花了这么多时间...无论如何,非常感谢。
    【解决方案3】:

    我遇到了类似的问题。我可以按照视频教程 https://www.youtube.com/watch?v=NSX-ib2aMDQ

    进行修复

    我刚刚将 skip-grant-tables 添加到 my.ini 文件中。下面是 my.ini 文件的示例部分。

    # Example MySQL config file for small systems.
    #
    # This is for a system with little memory (<= 64M) where MySQL is only used
    # from time to time and it's important that the mysqld daemon
    # doesn't use much resources.
    #
    # You can copy this file to
    # C:/xampp/mysql/bin/my.cnf to set global options,
    # mysql-data-dir/my.cnf to set server-specific options (in this
    # installation this directory is C:/xampp/mysql/data) or
    # ~/.my.cnf to set user-specific options.
    #
    # In this file, you can use all long options that a program supports.
    # If you want to know which options a program supports, run the program
    # with the "--help" option.
    
    # The following options will be passed to all MySQL clients
    [client]
    # password       = your_password 
    port=3306
    socket="C:/xampp/mysql/mysql.sock"
    
    
    # Here follows entries for some specific programs 
    
    # The MySQL server
    default-character-set=utf8mb4
    [mysqld]
    skip-grant-tables
    port=3306
    socket="C:/xampp/mysql/mysql.sock"
    basedir="C:/xampp/mysql"
    tmpdir="C:/xampp/tmp"
    datadir="C:/xampp/mysql/data"
    pid_file="mysql.pid"
    # enable-named-pipe
    key_buffer=16M
    max_allowed_packet=1M
    sort_buffer_size=512K
    net_buffer_length=8K
    read_buffer_size=256K
    read_rnd_buffer_size=512K
    myisam_sort_buffer_size=8M
    log_error="mysql_error.log"
    
    

    【讨论】:

      【解决方案4】:
      sudo reboot
      

      如果不自动启动则启动mysql

      sudo service mysql start
      

      【讨论】:

        【解决方案5】:

        嘿伙计无需更改任何文件.. 它基本上是因为你的 mysqli 没有运行.. 检查控制面板中的 "action" 列。您应该看到“开始”意味着它关闭,您的 php 无法与睡眠数据库门锁定.. 这就是为什么

        解决它... 打开您安装 xampp 应用程序的文件夹,然后单击 xampp 启动,然后接受所有必要的批准..

        【讨论】:

          【解决方案6】:

          这也发生在我身上。但这是我修复它的方法。每当它给您该错误时,只需重新启动您的浏览器并再次登录 phpMyAdmin。无需代码,无需配置操作

          【讨论】:

            【解决方案7】:

            根据您发布的config.inc.php,您的root 用户密码是1234(正如我在$cfg['Servers'][$i]['password'] ='1234'; 行中看到的那样),但稍后在文件中定义控制用户时,您使用空白密码。

            我建议设置一个实际的 controluser,其权限比 root 少,但快速解决方法是编辑并制作它 更改:$cfg['Servers'][$i]['controlpass'] = '1234';

            要创建 controluser 帐户,请使用类似于以下的 SQL 命令:

            GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost'  IDENTIFIED BY 'pmapass';
            

            将您的 phpMyAdmin 配置存储数据库的名称(可能是“phpmyadmin”)替换为 &lt;pma_db&gt;,并将自定义密码替换为 pmapass.

            【讨论】:

              【解决方案8】:

              清除 phpmyadmin 并再次安装对我有用。

              使用此命令清除 phpmyadmin:

                  sudo apt-get purge --auto-remove phpmyadmin
              

              然后重新安装:

                  sudo apt-get install phpmyadmin
              

              【讨论】:

                【解决方案9】:

                重新安装phpmyadmin并尝试

                代码:

                sudo dpkg-reconfigure phpmyadmin

                如果这不起作用,请尝试 代码:

                sudo apt-get --purge remove phpmyadmin

                然后重新安装,如果这不起作用,我愿意打赌没关系,做 代码:

                sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf

                然后重启apache 代码:

                ##sudo /etc/init.d/apache reload sudo service apache2 reload

                【讨论】:

                  【解决方案10】:

                  找到文件config.default.php并替换

                  $cfg['Servers'][$i]['host'] = 'localhost'; 
                  

                  $cfg['Servers'][$i]['host'] = '127.0.0.1';
                  

                  然后登录。

                  【讨论】:

                    【解决方案11】:

                    取消注释: ...

                    $cfg['Servers'][$i]['user'] = 'root';
                    $cfg['Servers'][$i]['password'] = '';
                    /* Server parameters */
                    $cfg['Servers'][$i]['host'] = 'localhost'; //<--UNCOMMENT THIS
                    $cfg['Servers'][$i]['connect_type'] = 'tcp'; //<--UNCOMMENT THIS
                    

                    ...

                    因为您需要通过 localhost 进行连接。

                    【讨论】:

                    • 感谢您的回答。我现在试了一下,还是不行。
                    • 好的。您的配置文件必须有其他内容。如果我评论这两行,我的机器上会出现完全相同的错误。
                    猜你喜欢
                    • 2017-11-02
                    • 2012-07-15
                    • 2019-05-25
                    • 2015-09-30
                    • 2014-09-08
                    • 2013-04-24
                    • 2013-05-11
                    • 2022-12-09
                    • 2019-05-16
                    相关资源
                    最近更新 更多