Solved: Debugging hints for sql plugin
ostroffjh at users.sourceforge.net
Mon Dec 21 01:04:30 GMT 2020
On 2020.12.20 18:10, Jack Ostroff wrote:
> I decided to test the sql back end, but when I try to save as a mysql
> database, I get an exception thrown that opening the database
> failed. So, I'm debugging in
> kmymoney/plugins/sql/mymoneystoragesql_p.h. I've added some
> debugging output in createDatabase, and found something that doesn't
> make sense to me.
> After the maindb.open() fails (around line 2044,) I confirmed that
> among other values, that maindb.userName is "jack" as it should be.
> However, retrieving maindb.lastError.text(), I get "Access denied for
> user ''@'localhost' to database 'mysql' QMYSQL: Unable to connect".
> localhost is correct, as is the blank password, but where is the
> userName? I'm going to start digging into the code for
> QSqlDatabase.open() but thought I'd ask first if anyone can think of
> something I might be doing wrong. Just to confirm, I can run mysql
> at command line, and the database does open, so I know the db system
> (mariadb) is running, and I do have permissions to login.
This seems to actually be an accepted (if odd) behavior of MariaDB. (I
don't know if MySQL is the same or not). When you log in to the
database, if your credentials are invalid, instead of just a total
failure, it may let you in, but with privileges that only let you do or
see what can be done or seen by someone with no privileges. The
nameless or anonymous user is how you are actually connected to the
database in that case, and rather than creating the error for the
requesting user, it creates it for the user it actually knows about.
In this case, I don't think there is anything KMM can do, other than
perhaps add the additional information from lastError().text() to the
In this case, it was a new installation of MariaDB, and I had not
correctly set myself up as a new user, even though I thought I had done
More information about the KMyMoney-devel