ocsinventoryng icon indicating copy to clipboard operation
ocsinventoryng copied to clipboard

Connection to the database failed

Open MarchuckPL opened this issue 2 years ago • 16 comments

Hi, I have problem setting up connection to OCS DB in GLPI OCS extention. Both OSC and GLPI are installed on same VM using Apache and MariaDB. User "ocs_user" was used in OSC installation without problems so it have proper privilages to osc database. I can connect to osc DB using osc_user from within linux server and remotly. In host field I have tried "localhost" , 127.0.0.1 , and IP adress with http, https and without it. Also this is fresh installation of GLPI server

image

This is the error massage from GLPI debug mode: PHP Warning (2): mysqli::real_connect(): (HY000/1045): Access denied for user 'ocs_user'@'localhost' (using password: NO) in /var/www/html/glpi/src/DBmysql.php at line 247

Same massage is observed in DB errorlog: Access denied for user 'ocs_user'@'localhost' (using password: NO)

So far i tested reinstallig extension, reinstaling GLPI, creating new DB user with basic password using only letters and making sure is has full provilages to osc database.

image

Second account for connection testing image

image

  • The version of the plugin 2.0.0-rc2
  • The version of your GLPI 10.0.0-rc2

MarchuckPL avatar Mar 29 '22 15:03 MarchuckPL

Please test with master version ? https://github.com/pluginsGLPI/ocsinventoryng/archive/refs/heads/master.zip

tsmr avatar Mar 29 '22 15:03 tsmr

Same image

image

MarchuckPL avatar Mar 29 '22 15:03 MarchuckPL

You tried to enter your password again ?

tsmr avatar Mar 29 '22 16:03 tsmr

I just wanna point out that OSC Server And GLPI server are located in the same Vm using same Apache and same DB instace. OCS server can connect to ocs database without problems so i assume databes, databas user and privilages are setup right and still in OSCplugin setup i cannot connect to ocs database using same DB user that is working in OCS server. Password was "cleared" multiple times and each time it was copied from keepas, no option for misspeling

MarchuckPL avatar Mar 29 '22 16:03 MarchuckPL

Try to connect it with shell before ?

Try to enter your password again ? after install master version

tsmr avatar Mar 29 '22 16:03 tsmr

ocs database now has two users with full privilages, i can connect with both users to ocs database using mysql -u -p within ubuntu server that databes is installed, also i can can connect to ocs database with bot acc from my windows host using sqlmanagmentstudio. One of those users us used in OCS server that is currently running. All password was created and pasted using keepass. I cleared password after installing master version, saved then entered password once again and saved, multible times with same result.

MarchuckPL avatar Mar 29 '22 16:03 MarchuckPL

Have You tried this solution?

https://github.com/pluginsGLPI/ocsinventoryng/issues/312

ajavor avatar Mar 30 '22 09:03 ajavor

Hi, For me it was already set to encrypt image image

MarchuckPL avatar Mar 30 '22 12:03 MarchuckPL

Is there any file that i can check if password im entering in gui is stored correctly in config files? Also i wanna point out that after adding skip-grand-tables in 50-server.cnf osc extension started to work but this is not a solution, it opens full access to all databeses for all connection, it was done just for test

MarchuckPL avatar Mar 30 '22 14:03 MarchuckPL

Any more ideas? If You need more information i can provide any log, config etc just ask

MarchuckPL avatar Apr 01 '22 06:04 MarchuckPL

Problem is still not solved. I'll appreciate any help

MarchuckPL avatar Apr 04 '22 13:04 MarchuckPL

Changing MariaDB to MySQL or postgresql is worth testing?

MarchuckPL avatar Apr 06 '22 11:04 MarchuckPL

I got exactly the same issue with :

  • GLPI version : 10.0.0-rc3
  • OCS Inventory NG version : 2.0.0-rc2
  • MariaDB server bersion : 10.5.15-MariaDB-0+deb11u1 Debian 11
  • PHP version : 7.4.28

0xNath avatar Apr 12 '22 14:04 0xNath

Same here,

  • GLPI version : 10.0.0- final release
  • OCS Inventory NG version : 2.0.0-rc2
  • mysql 5.7
  • PHP version : 7.4

Frederico Gendorf

On Tue, Apr 12, 2022 at 11:19 AM Nathanaël Renaud @.***> wrote:

I got exactly the same issue with :

  • GLPI version : 10.0.0-rc3
  • OCS Inventory NG version : 2.0.0-rc2
  • MariaDB server bersion : 10.5.15-MariaDB-0+deb11u1 Debian 11
  • PHP version : 7.4.28

— Reply to this email directly, view it on GitHub https://github.com/pluginsGLPI/ocsinventoryng/issues/318#issuecomment-1096791932, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSWPYD3AVCJ3S7BJ7KMU2LVEWA5RANCNFSM5R6Y3T7Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

fgendorf avatar Apr 22 '22 14:04 fgendorf

try new version plugin 2.0.0 (final release). for me it works fine and syncs

obraz

obraz

ajavor avatar Apr 27 '22 13:04 ajavor

Problem is still not solved. I'll appreciate any help

I found a solution that worked for me!

The problem was that my db user password had special characters, I just created another user to access the db with simple password and it worked!

evillduck avatar Nov 21 '22 22:11 evillduck