After restarting MySQL, all data in the table disappears and the table becomes clean, as if they are stored in the cache.

How to make them not to disappear?

Distribution: ubuntu 14

  • How was the table created? - andreymal
  • What is the table engine? MEMORY? - Anton Shchyrov

1 answer 1

it looks like a β€œengine” has been selected for this table under the name memory (i.e., the table is stored in memory).

you can specify, for example, with the command:

 > show create table имя_Ρ‚Π°Π±Π»ΠΈΡ†Ρ‹; 

It will be shown exactly which sql command β€œcreates” this table. example output:

 ... ... create table `имя_Ρ‚Π°Π±Π»ΠΈΡ†Ρ‹` (...) engine=Π½Π°Π·Π²Π°Π½ΠΈΠ΅_Π΄Π²ΠΈΠΆΠΊΠ° ... 

You can see a list of all engines supported by your instance of mysqld , for example, like this:

 > show engines; 

example output:

 +--------------------+---------+- | Engine | Support | +--------------------+---------+- | MRG_MYISAM | YES | | CSV | YES | | MyISAM | YES | | BLACKHOLE | YES | | MEMORY | YES | | InnoDB | DEFAULT | | ARCHIVE | YES | | PERFORMANCE_SCHEMA | YES | | FEDERATED | NO | +--------------------+---------+- 

the engine about which default is written in the support column will be used by default if the engine does not explicitly specify the engine in the create table ... command.

To change the engine (theoretically, not available for any pairs of engines) of an already existing table, use the command:

 > alter table имя_Ρ‚Π°Π±Π»ΠΈΡ†Ρ‹ engine = Π½Π°Π·Π²Π°Π½ΠΈΠ΅_Π΄Π²ΠΈΠΆΠΊΠ°;