Closed PetieM closed 1 year ago
Just wondering if u could try setting mysql
to mariadb
in your config.json and see if it work?
If u use mysql u use mysql package,
If u use mariadb use the mariadb package,
so that might work as basically they are the same thing anyways
I'm specifically using the MySQL package so I'm not sure that's necessarily the best idea.
I'm specifically using the MySQL package so I'm not sure that's necessarily the best idea.
It shouldn't make a difference as they are both still mysql They just use different npm packages, so no real harm in changing a variable, restarting meshcentral, and let it install the mariadb package and connect to ur mysql package
Oh, got it. Can't hurt to try I suppose. Will do so when I have a chance and update here with the results. Thanks!
Oh, got it. Can't hurt to try I suppose. Will do so when I have a chance and update here with the results. Thanks!
No worries! I use mariadb with the mariadb option, with default user/password created, so I think it uses the caching password method rather than the native passport method,
Okay, finally had a chance to try it and no luck, unfortunately. The error in the log is as follows:
Auto-create database failed: SqlError: (conn=-1, no: 45037, SQLState: HY000) pool is ending, connection request aborted
config.json (with mysql back in place of mariadb):
@PetieM sadly i dont think this is going to be possible to implement
mysql package doesnt support caching_sha2_password - still awating pr merge https://github.com/mysqljs/mysql/pull/2233
mysql2 package doesnt support caching_sha2_password https://github.com/sidorares/node-mysql2/issues/1248#issuecomment-1637257814
mariadb package doesnt support caching_sha2_password
i think we are out of options im afraid
the only thing to do is change the password to use other password encryption methods
IGNORE MY PREVIOUS COMMENT
this is possible! we can use mysql2
i forgot to change require('mysql')
in a few different places but it connects!!!
i just need to fix the below error now
You have tried to call .then(), .catch(), or invoked await on the result of query that is not a promise, which is a programming error. Try calling con.promise().query(), or require('mysql2/promise') instead of 'mysql2' for a promise-compatible version of the query interface. To learn how to use async/await or Promises check out documentation at https://www.npmjs.com/package/mysql2#using-promise-wrapper, or the mysql2 documentation at https://github.com/sidorares/node-mysql2/tree/master/documentation/en/Promise-Wrapper.md
That's awesome news! I had already switched back to mysql_native_password but will happily test if/when a fix for that last error is found. Either way though, I appreciate you jumping on this so quickly!
@PetieM all fixed from what i can see!
give it a try when u have chance
npm install https://github.com/Ylianst/MeshCentral#fix-mysql8
this will install the patch branch and then roll back when finished
npm install meshcentral
@si458 That seems to be working! I had to manually fix some npm errors (via npm audit fix) but after that, mysql2 installed and I was able to connect to the database with caching_sha2_password enabled for the user so I think we're good. Thank you!
@si458 That seems to be working! I had to manually fix some npm errors (via npm audit fix) but after that, mysql2 installed and I was able to connect to the database with caching_sha2_password enabled for the user so I think we're good. Thank you!
what errors where u getting or was this just related to your setup?
It may have just been my setup. After installing the mysql8 fix branch, I tried to start it and it just kept looping while installing mysql2 so I stopped MeshCentral, manually ran npm install mysql2, and saw there were some npm errors (not described - just listed as 2 critical). I ran npm audit fix, it fixed itself, and then I was able to run npm install mysql2 again which worked and MeshCentral started just fine.
Describe the bug Newer versions of MySQL default to caching_sha2_password for user authentication. Right now, The Node.js version in use does not support this authentication type.
To Reproduce
Expected behavior The connection succeeds and the database is accessible.
Screenshots N/A
Server Software (please complete the following information):
Client Device (please complete the following information):
Remote Device (please complete the following information): N/A
Additional context There seems to be a potential easy solution to this issue here: https://stackoverflow.com/questions/50373427/node-js-cant-authenticate-to-mysql-8-0#answer-74458804
I'm not sure if it would actually be that easy to implement in MeshCentral but if it is, this could be a quick fix.
Your config.json file
Thank you!