在MySQL服务启动时运行SQL查询

编程入门 行业动态 更新时间:2024-10-27 20:31:37
本文介绍了在MySQL服务启动时运行SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经在mysql上创建了HEAP(ram)表,以加快查询速度.但是在mysql服务器重启后,我的堆表中的数据没有被加载.

I have created HEAP (ram) table on mysql for faster query. But after mysql server restarted, the data in my Heap tables is not loaded.

我的常规表名称:ID为productisname的产品,状态为myisam

My normal table name: products with id, product_name, status as myisam

id => 整数和自动递增的主键

id => integer and auto_increment, primary key

产品名称=> var_char和键(索引)

product_name => var_char and key(index)

状态=> 布尔值

实际查询:

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

我想提高速度,因此我创建了具有与mysql HEAP表相同的结构并命名为 products_ram 的表. 我正在使用此代码进行填充:

I want to increase speed, so i created table with same structure and with named products_ram as mysql HEAP table. I am using this code for fill:

insert p_shop.products_ram select * from p_shop.products;

但是,当重启mysql实例HEAP(ram)表数据时,就消失了.

But when restart mysql instance HEAP (ram) table data has gone.

我找到了有关mysql内存存储的文档: dev.mysql/doc/refman /5.0/en/memory-storage-engine.html

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

但是我找不到我想要的东西.

But i can't find what i looking for.

我想将产品表中的数据自动插入/复制到mysql服务器初始化中的products_ram表中.

I want to insert/copy my data from products table to products_ram table on mysql server initialization automatically.

任何帮助将不胜感激.

我的操作系统:Windows Server 2008 R2 和Mysql:MySQL 5.5

My Operating System : Windows Server 2008 R2 And Mysql : MySQL 5.5

推荐答案

init_file 服务器选项可让您定义要在启动时执行的任意SQL语句.

The init_file server option lets you define arbitrary SQL statements to be executed on startup.

随着资源在目标站点上移动,更改了链接.

Changed the link as the resource has moved on the target site.

更多推荐

在MySQL服务启动时运行SQL查询

本文发布于:2023-11-05 06:24:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560145.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:启动时   MySQL   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!