nuxsmin / sysPass

Systems Password Manager
https://syspass.org
GNU General Public License v3.0
974 stars 207 forks source link

Not able to complete setup Database can't connect #1086

Closed davidginn524 closed 5 years ago

davidginn524 commented 5 years ago

sysPass Version 2.1

Describe the question I have had many problems installing this. My first problem was related to this https://github.com/nuxsmin/sysPass/issues/256 It fixed the 500 error by enabling the php plugging I then had the install in a different language even though my locales was en_GB I reset my locales to en_US and that fixed it here https://github.com/nuxsmin/sysPass/issues/609

Now I am on the configuration screen and it won't connect to the database. I have tried the root user. I have added a password to the root user. I have tried granting all priveleges to another user "syspass" SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' SQLSTATE[HY000] [1698] Access denied for user 'syspass'@'localhost'

I know its connecting because if I change it from Localhost or 127.0.0.1 it says it cant connect. I also know if I create a database called "test" then enter that as the database on the configuration page it says "Please, enter a new database or delete the existing one". Which tells me it has the username and password correct/permissions because it can check to see if a database is even there.

I have restricted anonymous users and performed the mysql_secure_installation

Platform (please complete the following information): Running on ESXI 6.7

Additional context I have looked at the config logs. A lot of it is in a different language so I can't read it

I am honestly out of ideas.

nuxsmin commented 5 years ago

Hello, it's really weird since it's connecting indeed. Did you try hosting mode? (http://doc.syspass.org/en/installing/hostingmode.html)

Regards

davidginn524 commented 5 years ago

so with that, I tried root that has full access to the mariadb mysql and it errors out saying I don't have rights. However If I try the syspass user it will perform the loading screen as if it doing something for a few seconds. then give me "Internal Server Errorerror" telling me the user is able to access the sql

nuxsmin commented 5 years ago

Hmm, is there any messages in syspass.log file? (Within config directory)

davidginn524 commented 5 years ago

Caller 5: SP\Core\Plugin\PluginUtil\getEnabledPlugins 2018-10-23 18:05:58 - SQL : SELECT plugin_name FROM plugins WHERE BIN(plugin_enabled) = 1 2018-10-23 18:05:58 - Action: getResultsArray -- Description: Error while querying No es posible conectar con la BD (0) -- Details: SQL : SELECT plugin_name FROM plugins WHERE BIN(plugin_enabled) = 1 2018-10-23 18:09:33 - Exception: No es posible conectar con la BD - Compruebe los datos de conexión 2018-10-23 18:09:33 - #0 SP\Storage\DB->prepareQueryData() called at [/var/www/html/sysPass/inc/SP/Storage/DB.class.php:1$

1 SP\Storage\DB->doQuery() called at [/var/www/html/sysPass/inc/SP/Storage/DB.class.php:105]

2 SP\Storage\DB::getResults() called at [/var/www/html/sysPass/inc/SP/Storage/DB.class.php:81]

3 SP\Storage\DB::getResultsArray() called at [/var/www/html/sysPass/inc/SP/Mgmt/Plugins/Plugin.class.php:287]

4 SP\Mgmt\Plugins\Plugin->getEnabled() called at [/var/www/html/sysPass/inc/SP/Core/Plugin/PluginUtil.class.php:185]

5 SP\Core\Plugin\PluginUtil::getEnabledPlugins() called at [/var/www/html/sysPass/ajax/ajax_getEnvironment.php:54]

2018-10-23 18:09:33 - Error while querying No es posible conectar con la BD (0) Caller 1: SP\Storage\DB\logDBException Caller 2: SP\Storage\DB\getResults Caller 3: SP\Storage\DB\getResultsArray Caller 4: SP\Mgmt\Plugins\Plugin\getEnabled Caller 5: SP\Core\Plugin\PluginUtil\getEnabledPlugins 2018-10-23 18:09:33 - SQL : SELECT plugin_name FROM plugins WHERE BIN(plugin_enabled) = 1 2018-10-23 18:09:33 - Action: getResultsArray -- Description: Error while querying No es posible conectar con la BD (0) -- Details: SQL : SELECT plugin_name FROM plugins WHERE BIN(plugin_enabled) = 1 2018-10-24 18:54:59 - Rollback 2018-10-24 18:55:05 - Rollback 2018-10-24 18:55:47 - Rollback 2018-10-24 19:00:02 - Rollback 2018-10-24 19:00:46 - Rollback 2018-10-24 19:01:00 - Rollback 2018-10-24 19:01:06 - Rollback 2018-10-24 19:03:46 - Rollback 2018-10-24 20:30:25 - Rollback 2018-10-24 20:59:37 - Exception: No es posible conectar con la BD - Compruebe los datos de conexión 2018-10-24 20:59:37 - #0 SP\Storage\DB->prepareQueryData() called at [/var/www/html/sysPass/inc/SP/Storage/DB.class.php:1$

1 SP\Storage\DB->doQuery() called at [/var/www/html/sysPass/inc/SP/Storage/DB.class.php:105]

2 SP\Storage\DB::getResults() called at [/var/www/html/sysPass/inc/SP/Storage/DB.class.php:81]

3 SP\Storage\DB::getResultsArray() called at [/var/www/html/sysPass/inc/SP/Mgmt/Plugins/Plugin.class.php:287]

4 SP\Mgmt\Plugins\Plugin->getEnabled() called at [/var/www/html/sysPass/inc/SP/Core/Plugin/PluginUtil.class.php:185]

5 SP\Core\Plugin\PluginUtil::getEnabledPlugins() called at [/var/www/html/sysPass/ajax/ajax_getEnvironment.php:54]

2018-10-24 20:59:37 - Error while querying No es posible conectar con la BD (0) Caller 1: SP\Storage\DB\logDBException Caller 2: SP\Storage\DB\getResults Caller 3: SP\Storage\DB\getResultsArray Caller 4: SP\Mgmt\Plugins\Plugin\getEnabled Caller 5: SP\Core\Plugin\PluginUtil\getEnabledPlugins 2018-10-24 20:59:37 - SQL : SELECT plugin_name FROM plugins WHERE BIN(plugin_enabled) = 1 2018-10-24 20:59:37 - Action: getResultsArray -- Description: Error while querying No es posible conectar con la BD (0) -- Details: SQL : SELECT plugin_name FROM plugins WHERE BIN(plugin_enabled) = 1 2018-10-24 21:00:18 - Rollback 2018-10-24 21:00:31 - Rollback 2018-10-24 21:00:52 - Rollback 2018-10-24 21:01:05 - Rollback 2018-10-24 21:01:09 - Rollback 2018-10-24 21:25:57 - Action: Configuration -- Description: Update Configuration -- Details: 2018-10-24 21:25:58 - Action: Configuration -- Description: Update Configuration -- Details: Parameter : version Value : 211618061901 2018-10-24 21:26:36 - Action: Configuration -- Description: Update Configuration -- Details: 2018-10-24 21:26:37 - Action: Configuration -- Description: Update Configuration -- Details: Parameter : version Value : 211618061901

nuxsmin commented 5 years ago

It seems a database connection error. Are you connecting to the Unix socket or TCP instead?

davidginn524 commented 5 years ago

Honestly not sure, that is something I did not check. How would I check that? or configure that

nuxsmin commented 5 years ago

It can be got from my.cnf file or mariadb.cnf

Alternatively, issuing netstat -tln | grep 3306 should display if the database port is listening.

Unix socket is used by default in most installations, so you can tell sysPass to use it instead by setting the path to it.

nuxsmin commented 5 years ago

The socket path should be unix:/path/to/it

davidginn524 commented 5 years ago

for the command you gave me tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN

for both my.cnf and mariadb.cnf located /etc/mysql/ they include

!includedir /etc/mysql/conf.d/ !includedir /etc/mysql/mariadb.conf.d/ and within those folders have other cnfs all which don't have anything that I see about the ports or unix

davidginn524 commented 5 years ago

I did find a socket finally in /etc/mysql/mariadb.conf.d/50-server.cnf

socket = /var/run/mysqld/mysqld.sock

user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking

What did you want me to do with the sock? disable it with #?

davidginn524 commented 5 years ago

nevermind. I have input "unix:/var/run/mysqld/mysqld.sock" for the database location and it still errors out "Internal Server Errorerror" I check the config log and it shows corresponding

2018-10-24 22:32:19 - Action: Configuration -- Description: Update Configuration -- Details: 2018-10-24 22:32:20 - Action: Configuration -- Description: Update Configuration -- Details: Parameter : version Value : 211618061901

Also thank you very much for your time on debugging this as I am at a loss. I might try this on ubuntu even though you don't have it listed for install.

nuxsmin commented 5 years ago

Is that error showed up on the installation page or did it on login instead?

Also thank you very much for your time on debugging this as I am at a loss. I might try this on ubuntu even though you don't have it listed for install.

Your're welcome. Although Ubuntu is not listed, it should work because it 's a Debian based one.

nuxsmin commented 5 years ago

Please, could you try out connecting through the mysql client?

davidginn524 commented 5 years ago

I will take screenshots when i get home from work. The error that is in "" happen in a red popup box upon clicking submit

I can connect to that database using that user through the commandline of debian. I am able to drop the database and readd it. Will screenshot the permissions

Will also try centos since you have it listed

davidginn524 commented 5 years ago

I am going to work on getting you those screenshots tonight however. In the meanwhile I might have discovered a bug. i setup a fresh install of debian 9.5 to install it and I get a server 500 error. I took a look at the apache2 error.log and here are the details. i don't want to overwhelm you with stuff but i can create a seperate bug report if you'd like [Thu Oct 25 14:49:09.488462 2018] [:error] [pid 792] [client 192.168.20.3:59548] PHP Fatal error: Uncaught Error: Call to undefined function mb_strlen() in /var/www/html/sysPass/inc/BaseFunctions.php:67\nStack trace:\n#0 /var/www/html/sysPass/inc/themes/material-blue/inc/Icons.class.php(46): __('A\\xC3\\xB1adir')\n#1 /var/www/html/sysPass/inc/SP/Core/UI/ThemeIconsBase.class.php(127): Theme\\Icons->setIcons()\n#2 /var/www/html/sysPass/inc/SP/Core/UI/Theme.class.php(129): SP\\Core\\UI\\ThemeIconsBase->__construct()\n#3 /var/www/html/sysPass/inc/SP/Core/UI/Theme.class.php(73): SP\\Core\\UI\\Theme->initIcons()\n#4 /var/www/html/sysPass/inc/SP/Core/DiFactory.class.php(128): SP\\Core\\UI\\Theme->__construct()\n#5 /var/www/html/sysPass/inc/SP/Core/Init.class.php(156): SP\\Core\\DiFactory::getTheme()\n#6 /var/www/html/sysPass/inc/Base.php(68): SP\\Core\\Init::start()\n#7 /var/www/html/sysPass/index.php(31): require('/var/www/html/s...')\n#8 {main}\n thrown in /var/www/html/sysPass/inc/BaseFunctions.php on line 67

nuxsmin commented 5 years ago

No worries...

This error is related to a missing PHP module: mbstring (used for multi-byte character strings)

davidginn524 commented 5 years ago

error1 The one above happens when I have created a database "test" assigned a user with ALL permissions granted for the entire system. error2 the one above is what happens when i entered "test1" into the database field which test1 does not exist. This tells me that the user syspass is using is able to connect and query to the database because it knows it doesn't exist. if it couldn't connect then it wouldn't know. below is my config but I have also tried 127.0.0.1 and localhost. configinfo

nuxsmin commented 5 years ago

Hmm, the first one is most likely a PHP error during the request. Are you setting the first field as the sysPass user and not the database one?. The installer will create a database user by prefixing the filled in with 'sp_'.

davidginn524 commented 5 years ago

Is there any log that you know of that I can investigate the "internal server errorerror"? maybe that would give us something? that makes sense that you would have something creating a db :)

davidginn524 commented 5 years ago

All i have in the config log of syspass is 2018-10-25 21:39:36 - Action: Configuration -- Description: Update Configuration -- Details: 2018-10-25 21:39:37 - Action: Configuration -- Description: Update Configuration -- Details: Parameter : version Value : 211618061901

nuxsmin commented 5 years ago

The web server log should point to a PHP error.

davidginn524 commented 5 years ago

I am still continuing to debug. i shall get back to you. Thanks again for your time

davidginn524 commented 5 years ago

Does this have to be put int /var/www/html? Reason I ask is I installed LAMP to try and work around the current issues I am having which installs PHPmyadmin, mariadb, apache etc. However the location for that install is /data/www/default/ and when i put it in there. The config doesn't like it. Is the config hard coded for that path?

nuxsmin commented 5 years ago

Hello,

However the location for that install is /data/www/default/ and when i put it in there. The config doesn't like it. Is the config hard coded for that path?

No, it isn't hard coded, you can use any location for the root directory.

Regards

davidginn524 commented 5 years ago

Thanks for closing sorry have lack of time. clearly not the problem of your program but thanks for helping anyway. Will eventually get it installed

nuxsmin commented 5 years ago

No worries, just cleaning up some old issues.

Thanks for the feedback!