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
(2019-07-27, 20:56)black_eagle Wrote: [ -> ]DROP USER Kodi;
I'm not sure how strict MySQL is, but better keep uppercase and lowercase separate.
Kodi's mysql user is 'kodi'.
(2019-07-27, 21:49)Klojum Wrote: [ -> ]
(2019-07-27, 20:56)black_eagle Wrote: [ -> ]DROP USER Kodi;
I'm not sure how strict MySQL is, but better keep uppercase and lowercase separate.
Kodi's mysql user is 'kodi'.  
You are right of course, and that was a typo on my part, but of course, the actual username could be anything. Kodi can use anything as a username as long as the username and password are specified in advancedsettings.xml. Tt could be 'Mr_Blobby', 'white_spots_on_pink_are_cool' or whatever.

The important thing is that whatever you tell MySQL/MariaDB is the username and password is accurately reflected in advancedsettings.xml.  Maybe I should have been clearer about that.  But yeah, case may make a difference here so the OP should be aware of that.  Thanks for pointing it out.
(2019-07-27, 20:56)black_eagle Wrote: [ -> ]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.
When I try to create the kodi user using the command: GRANT ALL ON *.* TO 'kodi' @ '%' IDENTIFIED BY 'kodi'; I get the following error ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''%' IDENTIFIED BY 'kodi'' at line 1
Don't use the wildcard bit then.  Try just
sql:
CREATE USER 'kodi' IDENTIFIED BY 'kodi';
GRANT ALL ON *.* TO 'kodi';

or you could combine the two into the one GRANT ALL etc command.

You could even create the kodi user without a password as it's not really a security issue on a local home network, in which case it's just
sql:
CREATE USER 'kodi';
GRANT ALL ON *.* to 'kodi';
FLUSH PRIVILEGES;

Example from my server;
sql:
mysql> DROP USER 'kodi';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT user, host FROM mysql.user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| xbmc             | %         |
| zabbix           | %         |
| debian-sys-maint | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
6 rows in set (0.00 sec)

mysql> CREATE USER 'kodi';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON *.* to 'kodi';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT user, host FROM mysql.user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| kodi             | %         |
| xbmc             | %         |
| zabbix           | %         |
| debian-sys-maint | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
7 rows in set (0.00 sec)

mysql> SHOW GRANTS FOR 'kodi';
+-------------------------------------------+
| Grants for kodi@%                         |
+-------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'kodi'@'%' |
+-------------------------------------------+
1 row in set (0.00 sec)

mysql> quit;
Bye
floyd@sapphire:~$ mysql -u kodi -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 441711
Server version: 5.7.21-0ubuntu0.16.04.1 (Ubuntu)

Copyright © 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Although it asks for a password, I didn't create one as you can see, so I just hit enter at the password prompt and it logs in.
Everything seems to be working now. Thank you very much!
Great news, glad you're sorted Smile
Pages: 1 2