Kodi Community Forum

Full Version: Problem Creating User For Kodi In Mariadb
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I'm running Kodi 17.6 on 2 clients and just upgraded my server to Debian 10 Buster. I installed Mariadb Ver 15.1 Distrib 10.3.15-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

The problem I'm having is Kodi won't create a database because Mariadb doesn't like any password I try. I keep getting the following error: Failed to save user : SQL set password for 'kodi'@'%' = 'kodi' failed : Password hash should be a 41-digit hexadecimal number.
Thanks
Jim
(2019-07-24, 19:03)jimkoh Wrote: [ -> ]Password hash should be a 41-digit hexadecimal number.

Buster and MariaDB versions are both totally new software versions. Hiccups can happen.
Are you sure your SQL query is correct, without any typos?
Don't use password().

sql:
GRANT ALL ON *.* TO 'kodi' @ '%' IDENTIFIED BY 'kodi';
flush privileges;

Note, kodi user must not exist.
Try:

sql:
SET PASSWORD FOR 'kodi'@'%' = PASSWORD('kodi');

The PASSWORD() function should create the needed hash.

Edit: Nevermind, @black_eagle is faster. Smile
If the Kodi wiki is incomplete or outdated on newer SQL queries for MariaDB v15 and up, do say so.
(2019-07-24, 19:53)Klojum Wrote: [ -> ]If the Kodi wiki is incomplete or outdated on newer SQL queries for MariaDB v15 and up, do say so.

I don't think it is.  Wiki says ;
Quote:CREATE USER 'kodi' IDENTIFIED BY 'kodi';
GRANT ALL ON *.* TO 'kodi';
So, the wiki doesn't state to use PASSWORD().

Grant will do the entire thing, creating the user if it doesn't exist. However, if you call PASSWORD() and what it returns differs from what the authentication plugin wants, then you get an error. You can also get around it with 'SET old_passwords = 0;' The value of old_passwords specifies the hashing method used by PASSWORD().

MySQL versions less than 5.7.5 don't have this issue.  I don't know about mariadb versions because I don't use it myself.
(2019-07-24, 20:16)black_eagle Wrote: [ -> ]
(2019-07-24, 19:53)Klojum Wrote: [ -> ]If the Kodi wiki is incomplete or outdated on newer SQL queries for MariaDB v15 and up, do say so.

I don't think it is.  Wiki says ;
Quote:CREATE USER 'kodi' IDENTIFIED BY 'kodi';
GRANT ALL ON *.* TO 'kodi';
So, the wiki doesn't state to use PASSWORD().

Grant will do the entire thing, creating the user if it doesn't exist. However, if you call PASSWORD() and what it returns differs from what the authentication plugin wants, then you get an error. You can also get around it with 'SET old_passwords = 0;' The value of old_passwords specifies the hashing method used by PASSWORD().

MySQL versions less than 5.7.5 don't have this issue.  I don't know about mariadb versions because I don't use it myself.
I use Webmin to interact with my server and created the Mariadb user through the module. Even if I have it create a password for me, it doesn't work. I've also tried using CREATE USER 'kodi' IDENTIFIED BY 'kodi'; GRANT ALL ON *.* TO 'kodi'; as per the wiki which also gives me the error. I only use the database for Kodi so I don't know where to use PASSWORD() or SET old_passwords = 0; I did backup my database prior to the upgrade, but I haven't figured out how to do a restore. Any suggestions? I need a step by step..
(2019-07-24, 22:39)jimkoh Wrote: [ -> ]I use Webmin to interact with my server and created the Mariadb user through the module. Even if I have it create a password for me, it doesn't work. I've also tried using CREATE USER 'kodi' IDENTIFIED BY 'kodi'; GRANT ALL ON *.* TO 'kodi'; as per the wiki which also gives me the error. I only use the database for Kodi so I don't know where to use PASSWORD() or SET old_passwords = 0; I did backup my database prior to the upgrade, but I haven't figured out how to do a restore. Any suggestions? I need a step by step..
Oh, OK.... I do all my admin (not that there is much once it's set up) from command line.

Anyway -

Webmin -> Servers -> MySQL Server

If the database already exists and you want to overwrite it with the contents of a .sql file (a mysqldump), click to select the database in the list.  <- this should be you ! (Select the database you want to replace)

Otherwise, click to create a new database. After creation, click to select that database.  < Database should already exist, so this shouldn't be you.

The click "Execute SQL" and then "Run SQL from File". Browse to find the .sql file and do it. (this is the backup you made earlier).

If that doesn't help/work, I can walk you through doing it from command line, provided you know how to get access to the machine that mariadb is running on, and the user and root password for mariadb.  Personally, I'm not that keen on web adminstration of stuff because it doesn't teach you anything, and when it falls over, well ..........
(2019-07-24, 22:54)black_eagle Wrote: [ -> ]
(2019-07-24, 22:39)jimkoh Wrote: [ -> ]I use Webmin to interact with my server and created the Mariadb user through the module. Even if I have it create a password for me, it doesn't work. I've also tried using CREATE USER 'kodi' IDENTIFIED BY 'kodi'; GRANT ALL ON *.* TO 'kodi'; as per the wiki which also gives me the error. I only use the database for Kodi so I don't know where to use PASSWORD() or SET old_passwords = 0; I did backup my database prior to the upgrade, but I haven't figured out how to do a restore. Any suggestions? I need a step by step..
Oh, OK.... I do all my admin (not that there is much once it's set up) from command line.

Anyway -

Webmin -> Servers -> MySQL Server

If the database already exists and you want to overwrite it with the contents of a .sql file (a mysqldump), click to select the database in the list.  <- this should be you ! (Select the database you want to replace)

Otherwise, click to create a new database. After creation, click to select that database.  < Database should already exist, so this shouldn't be you.

The click "Execute SQL" and then "Run SQL from File". Browse to find the .sql file and do it. (this is the backup you made earlier).

If that doesn't help/work, I can walk you through doing it from command line, provided you know how to get access to the machine that mariadb is running on, and the user and root password for mariadb.  Personally, I'm not that keen on web adminstration of stuff because it doesn't teach you anything, and when it falls over, well ..........
Restoring the database didn't work. A lot of the records were missing for some reason. At this point I would just like to start with a fresh database. Can you show me how to create a user/password for the Mariadb that it will accept?
Thanks
Jim
(2019-07-25, 17:59)jimkoh Wrote: [ -> ]Restoring the database didn't work. A lot of the records were missing for some reason. At this point I would just like to start with a fresh database. Can you show me how to create a user/password for the Mariadb that it will accept?
Thanks
Jim

Can you log into whatever is running the database so that you can get to a command prompt ?

EG, if the db is running on the same machine, then you should be able to open a terminal and connect to it directly.
If it's running on a machine on your local network then you should be able to SSH to that machine and get to a terminal that way.

Basically, log into your server over SSH/telnet/whatever and get to a terminal prompt.  You will need to know the root user for mariadb and the password that you set when you installed it.  If your server is running Windows, then the initial commands will be slightly different so please let me know which OS your server is running.
(2019-07-25, 21:10)black_eagle Wrote: [ -> ]
(2019-07-25, 17:59)jimkoh Wrote: [ -> ]Restoring the database didn't work. A lot of the records were missing for some reason. At this point I would just like to start with a fresh database. Can you show me how to create a user/password for the Mariadb that it will accept?
Thanks
Jim

Can you log into whatever is running the database so that you can get to a command prompt ?

EG, if the db is running on the same machine, then you should be able to open a terminal and connect to it directly.
If it's running on a machine on your local network then you should be able to SSH to that machine and get to a terminal that way.

Basically, log into your server over SSH/telnet/whatever and get to a terminal prompt.  You will need to know the root user for mariadb and the password that you set when you installed it.  If your server is running Windows, then the initial commands will be slightly different so please let me know which OS your server is running.
I'm running Debian 10 Buster on the server. I can SSH into the server or use Webmin.
SSH to the server then.

Once connected, enter (assuming you set up a root user for mariadb when you installed it)
php:
mysql -u root -p

If you do not know the password you can follow this guide to change it.

Once logged in as the root user, you need to determine if the kodi user already exists.
php:
SELECT User FROM mysql.user;

If that doesn't show the kodi user, then all is good !! If it does, we need to remove it with
php:
DROP USER Kodi;

Now we should be able to create the kodi user with
sql:
GRANT ALL ON *.* TO 'kodi' @ '%' IDENTIFIED BY 'kodi';
That should create a kodi user with a password of 'kodi' with full privileges.

You then need to enter
sql:
FLUSH PRIVILEGES;
so that everything is updated.

At this point, you can create your 'advancedsettings.xml' pointing to your db server and kodi should be able to login and create the relevant databases.


Hope that helps.
Pages: 1 2