在MySQL服务启动时运行SQL查询 [英] Run SQL query on MySQL service startup

查看:52
本文介绍了在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内存存储的文档: http://dev.mysql.com/doc/refman /5.0/en/memory-storage-engine.html

I found a document about mysql memory storage : http://dev.mysql.com/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

推荐答案

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查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆