Hello,
Fairly new to HA and hoping someone can assist with this problem.
I’m running Home Assistant OS with MariaDB and upgraded the database from 2.5.1 to 2.5.2 (10.6.2). There were no issues after this upgrade. I followed this with updating to the 2023.2.3 release from 2023.2.1. Immediately after the restart my logbook stopped populating data and I got the error notification
" recorder_database_migration
The database migration failed, check [the logs]. Database Migration Failed"
The error log for that specific error is below. Any suggestions on how to fix this?
Database error during schema migration
Traceback (most recent call last):
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py”, line 1900, in _execute_context
self.dialect.do_execute(
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/default.py”, line 736, in do_execute
cursor.execute(statement, parameters)
File “/usr/local/lib/python3.10/site-packages/MySQLdb/cursors.py”, line 206, in execute
res = self._query(query)
File “/usr/local/lib/python3.10/site-packages/MySQLdb/cursors.py”, line 319, in _query
db.query(q)
File “/usr/local/lib/python3.10/site-packages/MySQLdb/connections.py”, line 254, in query
_mysql.connection.query(self, query)
MySQLdb.OperationalError: (1030, ‘Got error 106 “Socket is connected” from storage engine InnoDB’)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/recorder/core.py”, line 742, in _migrate_schema_and_setup_run
migration.migrate_schema(
File “/usr/src/homeassistant/homeassistant/components/recorder/migration.py”, line 154, in migrate_schema
_apply_update(hass, engine, session_maker, new_version, current_version)
File “/usr/src/homeassistant/homeassistant/components/recorder/migration.py”, line 854, in _apply_update
_create_index(session_maker, “states”, “ix_states_entity_id_last_updated_ts”)
File “/usr/src/homeassistant/homeassistant/components/recorder/migration.py”, line 204, in _create_index
raise_if_exception_missing_str(err, [“already exists”, “duplicate”])
File “/usr/src/homeassistant/homeassistant/components/recorder/migration.py”, line 65, in raise_if_exception_missing_str
raise ex
File “/usr/src/homeassistant/homeassistant/components/recorder/migration.py”, line 202, in _create_index
index.create(connection)
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/schema.py”, line 4353, in create
bind._run_ddl_visitor(ddl.SchemaGenerator, self, checkfirst=checkfirst)
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py”, line 2211, in _run_ddl_visitor
visitorcallable(self.dialect, self, **kwargs).traverse_single(element)
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/visitors.py”, line 524, in traverse_single
return meth(obj, **kw)
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py”, line 938, in visit_index
self.connection.execute(CreateIndex(index))
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/future/engine.py”, line 280, in execute
return self._execute_20(
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py”, line 1705, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/ddl.py”, line 80, in _execute_on_connection
return connection._execute_ddl(
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py”, line 1472, in _execute_ddl
ret = self._execute_context(
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py”, line 1943, in _execute_context
self.handle_dbapi_exception(
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py”, line 2124, in handle_dbapi_exception
util.raise(
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/util/compat.py”, line 211, in raise
raise exception
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py”, line 1900, in _execute_context
self.dialect.do_execute(
File “/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/default.py”, line 736, in do_execute
cursor.execute(statement, parameters)
File “/usr/local/lib/python3.10/site-packages/MySQLdb/cursors.py”, line 206, in execute
res = self._query(query)
File “/usr/local/lib/python3.10/site-packages/MySQLdb/cursors.py”, line 319, in _query
db.query(q)
File “/usr/local/lib/python3.10/site-packages/MySQLdb/connections.py”, line 254, in query
_mysql.connection.query(self, query)
sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (1030, ‘Got error 106 “Socket is connected” from storage engine InnoDB’)
[SQL: CREATE INDEX ix_states_entity_id_last_updated_ts ON states (entity_id, last_updated_ts)]
(Background on this error at: Error Messages — SQLAlchemy 1.4 Documentation)