adplus-dvertising
21.5 C
Amsterdam
angeloma
Senior Writer and partner

Change the storage engine on MariaDB / MySQL

This very short post deals with how to change the storage engine on MariaDB / MySQL. We will apply this to a specific table and you will also learn how to set it as default.

A storage engine is a small software module in MariaDB or MySQL to create, read, and update data from a database. Knowing which storage engine to use is a more important decision than it seems.

So, in MariaDB and MySQL the default engine is InnoDB. It is one of the used ones and even Oracle recommends using it for tables. Of course, this will depend on each situation and needs.

Other well-known storage engines are MyISAM, Memory, CSV, Merge, Archive, Federated, or Blackhole.

Change the storage engine on MariaDB / MySQL

The reality is that it is quite easy to change the storage engine of a specific table, the basic syntax in the MariaDB / MySQL shell is as follows:

> ALTER TABLE [table_name] ENGINE = [new_engine];

For example, if we want a table that is defined with the InnoDB engine to be passed to the MyISAM engine, the syntax would be as follows:

> ALTER TABLE osradar ENGINE = MyISAM;

And so you can quickly change the storage engine to a table. However, it should be noted that this process can have an impact on the data and mainly in the form of creation and recovery of them. So do it if necessary.

Changing the storage engine by default on MariaDB / MySQL

To change the default storage engine, edit the MariaDB or MySQL configuration file. This can vary according to the versions of the operating system or the same program. In the case of Ubuntu 20.04 and MariaDB it is:

:~$ sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

And change the next line:

default-storage-engine=InnoDB

A:

default-storage-engine=MyISAM

Save the changes and close the editor.

Conclusion

The MariaDB or MySQL storage engine is one of the key parts for database work on a professional level. So it is always advisable to know how to change it to a table or the whole system.

So, share this post and join our Telegram Channel.

- Advertisement -

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Donate to Osradar

Latest article