Running SQL query when starting MySQL service

I created a HEAP table (ram) in mysql for a faster query. But after restarting the mysql server, the data in my Heap tables does not load.

My usual table name: products with id, product_name, myisam status

id => integer and auto_increment, primary key

product_name => var_char and key (index)

status => boolean

Actual request:

`Select id from products where product_name like "product_name"` 

I want to increase speed, so I created a table with the same structure and named products_ram as the HEAP table of the HEAP table. I use this code to populate:

 insert p_shop.products_ram select * from p_shop.products; 

But when restarting the mysql HEAP (ram) table data, the data disappeared.

I found a mysql memory storage document: http://dev.mysql.com/doc/refman/5.0/en/memory-storage-engine.html

But I can’t find what I’m looking for.

I want to automatically paste / copy my data from the product table to the products_ram table when mysql server is initialized.

Any help would be appreciated.

Edit: My operating system: Windows Server 2008 R2 And Mysql: MySQL 5.5

+5
source share
1 answer

The init_file parameter allows you to specify arbitrary SQL queries that must be executed at startup.

+4
source

Source: https://habr.com/ru/post/1209742/


All Articles