MySQL (OH2) to JDBC-MySQL (OH3) Migration failures

@tommycw10

I have made a manual a long time ago

CREATE USER 'openhab'@'localhost' IDENTIFIED BY 'openhabian';

because you are using Ubuntu you have to check the Identified name for your distro

GRANT ALL PRIVILEGES ON OpenHAB.* TO 'openhab'@'localhost';
FLUSH PRIVILEGES;

OpenHAB.* is the name of the database and the tables are selected with the *

Watch-out the database name is casesensitive.

These privileges are not stored in your database but somewhere else

if you go to your terminal and open access mysql

sudo mysql
MariaDB [(none)]> show databases;
   
+--------------------+
| Database           |
+--------------------+
| OpenHAB            |
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.003 sec)

You see there is a database called mysql

MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

MariaDB [mysql]> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| column_stats              |
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| global_priv               |
| gtid_slave_pos            |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| index_stats               |
| innodb_index_stats        |
| innodb_table_stats        |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| roles_mapping             |
| servers                   |
| slow_log                  |
| table_stats               |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| transaction_registry      |
| user                      |
+---------------------------+
31 rows in set (0.001 sec)

Then you see the table user.

select * from user where User='openhab';
// all lot of data that end with
1 rows in set (0.003 sec)

This means you have a user if it says Empty set (0.003sec ) you don’t have the permissions to enter the database.

After restoring the database, I had to add the user and the privileges. See my instructions.
There is no difference in setting up between MariaDB and MySQL. How ever I prefer and use MariaDB.

From your errors

 JDBC::store:  No connection to database.

If JDBC can’t connect to the server, your error is something like: server not properly configured.

If you have no connection to the database (that is in the MySQL server) could mean privilege or missing user or missing database. (Your DB is there with the proper name, so check the other two possibilities as described before.)

Good luck