skip to Main Content

I’m trying to get Emoncms working on a shared hosting MediaTemple web server with verified prerequisites like mod_rewrite and LAMP server. I’ve created the database with user and password, configured the settings.php to the best of my ability.

/ - 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

But when I access santiapps.com/emoncms/ I get:

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

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

I’ve put the database, user and password in the script. I’ve checked it and reset the password through their plesk.

  1. I know the password for that user is correct because I can log in with the password just fine via terminal using mysql -u user -p pass and I get the MariaDB server and I can then enter USE Emoncms and the prompt reads that I’m connected to Emoncms.

  2. The emoncms.log file created by the application is empty. I found a bunch of these in the web server 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 unknownn’

  3. I’ve checked most of the posts in SO about this user password:NO issue and they all pertain to root, which I am not. I’m using another user called marskoko.

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

  4. I can’t stop or start the server, I’ve tried service mysql stop and I get:

    Redirecting to /bin/systemctl stop mysql.service

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

    4.a) I have recently been suggested to try:

    service mysqld restart
    

    But I get a similar error:

    Redirecting to /bin/systemctl restart mysqld.service

    Failed to restart mysqld.service: Unit not found.

    But I know its running, otherwise I wouldn’t be able to view my other databases.

  5. I’ve created this php file:

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

    and ran it and I get this:

    Failed to open connection to MySQL server.

    5.a) When I use mysqli_connect_error() I get:

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

    NOTE: The user is different because I wanted to make sure there wasn’t some issue with the db or user, so I deleted the db and re-created it and changed the username. The db is still there and I can still access it via MariaDB using mysql command and the same password.

  6. I tried this suggestion:

    ps aux | grep mysql

    and I get this:

    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. I just tried logging into the db with the user/pass and I tried getting the table of users but got this:

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

Then again I just checked all my databases and neither have the users table in it. They have other tables which Ive added and work with, but not the user table. Maybe phpmyadmin hides that, I dunno.

I dunno what else to try.

2

Answers


  1. Chosen as BEST ANSWER

    Ok I figured it out. Digging around the php I tried logging the $password variable in the index.php of emoncms and it logged blank whilst the username, database or other variables logged correctly. I ended up replacing the $password for the actual password in the mysqli line and it works now. So then I just replaced the $password "" for '' and it works now.


  2. i think you can resolve this by the steps following

    1. start/stop mysql by using service mysqld start/stop/restart instead of service mysql start/stop/restart

    2. make sure you got the right password for mysql user – root, if no, please reset password by following step 3, else, skip step 3

    3. edit mysql config file, usually /etc/my.cny, add skip-grant-tables under [mysqld], then restart mysql, now you can go into mysql without password, then reset password by using

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

      flush privileges;

    4. that is all, please check it

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search