Assuming you are using Windows to access the HA instance. In phpMyAdmin, highlight the database homeassistant
, click on export tab and then click on Export button. This will create a file named homeassistant.sql
on your local PC, in the downloads folder.
You need to import this file into the new HA instance using phpMyAdmin. Will provide instructions for import.
The sql file is a text file which has all the sql commands and data to recreate the entire database structure + contents.
See example below:
– phpMyAdmin SQL Dump
– version 5.2.0
– https://www.phpmyadmin.net/
–
– Host: core-mariadb:3306
– Generation Time: Mar 12, 2023 at 05:43 PM
– Server version: 10.6.10-MariaDB
– PHP Version: 8.1.13
SET SQL_MODE = “NO_AUTO_VALUE_ON_ZERO”;
START TRANSACTION;
SET time_zone = “+00:00”;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
–
– Database: homeassistant
–
–
– Table structure for table events
–
CREATE TABLE events
(
event_id
int(11) NOT NULL,
event_type
varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
event_data
longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
origin
varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
origin_idx
smallint(6) DEFAULT NULL,
time_fired
datetime(6) DEFAULT NULL,
time_fired_ts
double DEFAULT NULL,
context_id
varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
context_user_id
varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
context_parent_id
varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
data_id
int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
–
– Dumping data for table events
–
INSERT INTO events
(event_id
, event_type
, event_data
, origin
, origin_idx
, time_fired
, time_fired_ts
, context_id
, context_user_id
, context_parent_id
, data_id
) VALUES
(1, ‘service_registered’, NULL, NULL, 0, NULL, 1678636038.993366, ‘01GVB82ETH0V0BW4D4VPXWZF9J’, NULL, NULL, 1),
(2, ‘service_registered’, NULL, NULL, 0, NULL, 1678636038.993396, ‘01GVB82ETHYBEWJ167BD65DRC7’, NULL, NULL, 2),
(3, ‘service_registered’, NULL, NULL, 0, NULL, 1678636038.99341, ‘01GVB82ETHHF97F72VPJFZBT32’, NULL, NULL, 3),
(4, ‘service_registered’, NULL, NULL, 0, NULL, 1678636038.99342, ‘01GVB82ETH1J8Y9755HV6PQE5G’, NULL, NULL, 4),
(5, ‘component_loaded’, NULL, NULL, 0, NULL, 1678636040.798116, ‘01GVB82GJYRQ2FHFTQGMK1K3YQ’, NULL, NULL, 5),
(6, ‘component_loaded’, NULL, NULL, 0, NULL, 1678636040.801571, ‘01GVB82GK1JZ1YKAQ8NQG12E1J’, NULL, NULL, 6),
(7, ‘component_loaded’, NULL, NULL, 0, NULL, 1678636040.803127, ‘01GVB82GK3ZSPP3MHCHK14B211’, NULL, NULL, 7),
(8, ‘component_loaded’, NULL, NULL, 0, NULL, 1678636040.821159, ‘01GVB82GKNNBK3Y529G0QGDRQE’, NULL, NULL, 8),
(9, ‘component_loaded’, NULL, NULL, 0, NULL, 1678636040.821419, ‘01GVB82GKNZF9VQYFX80JVR0FF’, NULL, NULL, 9),
(10, ‘panels_updated’, NULL, NULL, 0, NULL, 1678636040.824269, ‘01GVB82GKRN9JY1848JKNGNAWP’, NULL, NULL, NULL),
(11, ‘component_loaded’, NULL, NULL, 0, NULL, 1678636040.894998, ‘01GVB82GNYVSKKHGNS8T7GGTHS’, NULL, NULL, 10),
(12, ‘service_registered’, NULL, NULL, 0, NULL, 1678636040.988953, ‘01GVB82GRWQ3N0VVB6DX6H81S5’, NULL, NULL, 11),
(13, ‘service_registered’, NULL, NULL, 0, NULL, 1678636040.989025, ‘01GVB82GRX4W29TKZWKPW9Z3JX’, NULL, NULL, 12),
(14, ‘service_registered’, NULL, NULL, 0, NULL, 1678636040.98905, ‘01GVB82GRXEWQ42JD6WXQF7JDN’, NULL, NULL, 13),
(15, ‘service_registered’, NULL, NULL, 0, NULL, 1678636040.989072, ‘01GVB82GRX0AAQV11K1WEXTWQH’, NULL, NULL, 14),
(16, ‘service_registered’, NULL, NULL, 0, NULL, 1678636040.989092, ‘01GVB82GRXN1ZPYX8SCQYR8M2J’, NULL, NULL, 15),