php - MySQL Emoncms PHP 错误 : User Password:NO

标签 php mysql

我正在尝试让 Emoncms 在共享托管 MediaTemple Web 服务器上工作,该服务器具有经过验证的先决条件,例如 mod_rewrite 和 LAMP 服务器。我已经使用用户名和密码创建了数据库,并尽我所能配置了 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/ 时,我得到:

Can’t connect to database, please verify credentials/configuration in settings.php

Error message: Access denied for user ‘marskoko’@‘localhost’ (using password: NO).

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

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

  2. 应用程序创建的 emoncms.log 文件为空。我在网络服务器 error.log 中发现了一堆这样的东西:

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

  3. 我已经检查了 SO 中关于此用户密码的大部分帖子:没有问题,它们都与 root 有关,但我不是。我正在使用另一个名为 marskoko 的用户。

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

  4. 我无法停止或启动服务器,我试过 service mysql stop 并得到:

    Redirecting to /bin/systemctl stop mysql.service

    Failed to stop mysql.service: Unit mysql.service not loaded.

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

    service mysqld restart
    

    但是我得到一个类似的错误:

    Redirecting to /bin/systemctl restart mysqld.service

    Failed to restart mysqld.service: Unit not found.

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

  5. 我创建了这个 php 文件:

    <?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");
    \> 
    

    然后运行它,我得到了这个:

    Failed to open connection to MySQL server.

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

    Access denied for user 'emonuser'@'localhost' (using password: NO)

    注意:用户不同是因为我想确保数据库或用户没有问题,所以我删除了数据库并重新创建它并更改了用户名。数据库仍然存在,我仍然可以使用 mysql 命令和相同的密码通过 MariaDB 访问它。

  6. 我试过这个建议:

    ps 辅助 | 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. 我刚刚尝试使用用户/密码登录数据库,并尝试获取用户表但得到了这个:

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

然后我再次检查了我所有的数据库,但都没有用户表。他们有我添加和使用的其他表,但没有用户表。也许 phpmyadmin 隐藏了这一点,我不知道。

我不知道还能尝试什么。

最佳答案

我认为你可以通过以下步骤解决这个问题

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

  2. 确保您获得了 mysql 用户 root 的正确密码,如果没有,请按照第 3 步重设密码,否则,跳过第 3 步

  3. 编辑mysql配置文件,通常是/etc/my.cny,在[mysqld]下添加skip-grant-tables ,然后重启mysql,现在可以免密码进入mysql了,然后用

    重置密码

    update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';

    flush privileges;

  4. 就这些了,请检查一下

关于php - MySQL Emoncms PHP 错误 : User Password:NO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52564536/

相关文章:

php - 对数据库中的密码进行加密

php - jquery 悬停有效,onclick 无效

php - PHP 中的 MySQL 语法错误

php mysql 如果存在更新否则插入

mysql - Spring Boot 和 MySQL 找不到数据库

php - 在 mysql 更新时更改文件

php - zend 左连接计数不起作用

mysql - 不同输出的日期差异

php - WordPress 自定义查询

php - 用户登录后从数据库中显示网页上合适的信息