代码之家  ›  专栏  ›  技术社区  ›  marciokoko

MySQL Emoncms PHP错误:用户密码:否

  •  2
  • marciokoko  · 技术社区  · 6 年前

    情绪化 使用已验证的先决条件(如mod_rewrite和LAMP server)处理共享宿主MediaTemple web服务器。我用用户和密码创建了数据库,配置了 settings.php 尽我所能。

    / - this is root
    /emoncmsdata - Its 777 for data folders /phpfina & /phpfiwa & /phptimeseries
    /httpdocs - this is my public folder
    /httpdocs/emoncms - this is where the settings.php is and where modules are
    

    santiapps.com/emoncms/ 我得到:

    错误消息:用户marskoko@localhost的访问被拒绝(使用密码:NO)。

    我已经在脚本中输入了数据库、用户和密码。我已经检查过了,并通过他们的密码重置了密码。

    1. 我知道该用户的密码是正确的,因为我可以使用mysql-u user-p pass通过终端用密码很好地登录,然后我得到MariaDB服务器,然后输入USE 情绪化 提示显示我连接到 情绪化 .

    2. emoncms.log 应用程序创建的文件为空。我在web服务器error.log中找到了一堆:

      [Fri Sep 28 20:53:23.620729 2018][proxy_fcgi:error][pid 8219:tid 140039956670208][client 83.139.179.122:35214]AH01071:get error Primary script unknown\n

    3. 我已经检查了大部分关于这个用户密码的帖子:没有问题,它们都与根有关,我不是。我在用另一个叫marskoko的用户。

      Access denied for user 'root'@'localhost' (using password: NO)?Unable to authenticate php/Mysql?

    4. 我无法停止或启动服务器,我已经尝试过mysql服务停止,我得到:

      重定向到/bin/systemctl stop mysql.service

      未能停止mysql.service:未加载单元mysql.service。

      4.a)最近有人建议我尝试:

      service mysqld restart
      

      但我也有一个类似的错误:

      无法重新启动mysqld。服务:找不到单元。

      但我知道它在运行,否则我将无法查看我的其他数据库。

    5. <?php
      $db = mysqli_connect("localhost","marskoko","myPasshasAdollarSign") or die("Failed to open connection to MySQL server.");
      mysqli_select_db($db, "emoncms") or die("Unable to select database");
      \> 
      

      运行它,我得到这个:

      5.a)当我使用 mysqli_connect_error() 我得到:

      用户“emonuser”@“localhost”的访问被拒绝(使用密码:否)

    6. 我试过这个建议:

      ps aux | grep mysql

      mysql     7766  0.0  0.0 113200  1588 ?        Ss   Sep28   0:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
      mysql     8286  0.7  5.4 1906888 457400 ?      Sl   Sep28   5:12 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/lib/mysql/activacorp.net.err --pid-file=activacorp.net.pid --socket=/var/lib/mysql/mysql.sock --port=3306
      root     15702  0.0  0.0 112600  1068 pts/0    S+   09:17   0:00 grep --color=auto mysql
      
    7. 我刚刚试着用user/pass登录到数据库,我试着获取用户表,但是得到了:

      MariaDB [emoncms]> select * from user;
      ERROR 1146 (42S02): Table 'emoncms.user' doesn't exist
      

    我不知道还能尝试什么。

    2 回复  |  直到 5 年前
        1
  •  0
  •   tyloafer    6 年前

    我想你可以通过以下步骤来解决这个问题

    1. 使用service mysqld start/stop/restart而不是service mysql start/stop/restart启动/停止mysql

    2. 通常编辑mysql配置文件 /etc/my.cny ,添加 skip-grant-tables 在下面 [我的qld] ,然后重新启动mysql,现在可以不带密码进入mysql,然后使用

      刷新权限;

    3. 就这些,请检查一下

        2
  •  0
  •   marciokoko    6 年前

    好吧,我想出来了。在php中,我尝试将$password变量记录在emoncms的index.php中,当用户名、数据库或其他变量正确记录时,它记录为空。最后,我将mysqli行中的$password替换为实际的密码,现在它可以工作了。因此,我刚刚为“”替换了$password“”,现在它可以工作了。