Changing Table Engine in MySQL - mysql

I am using mysql and mysql workbench. I created 5 tables with innodb engine. I checked their engine and it was innodb before I insert data into them. I inserted data from 5 MyISAM tables and now my innodb tables are MyISAM. I can't change them. I used the alter table engine=innodb but it doesn't work.

From the manual: http://dev.mysql.com/doc/refman/5.1/en/alter-table.html
For example, to convert a table to be an InnoDB table, use this statement:
ALTER TABLE t1 ENGINE = InnoDB;
The outcome of attempting to change a table's storage engine is affected by whether the desired storage engine is available and the setting of the NO_ENGINE_SUBSTITUTION SQL mode, as described in Section 5.1.11, “Server SQL Modes”.
https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sqlmode_no_engine_substitution
When you create the table do you get any warning about the Engine type being unavailable?

It's not obvious. If you edit the table and then select the column tab the engine widget is not immediately visible. On the upper right of the edit window you will see two down pointing chevrons. Select the arrow once and additional widgets will appear. In the upper right hand corner there will now be widgets for the schema and engine.

Related

MATCH in MYSQL 5.5.24 not working

I am writing the following query :
select * from student where match(name,middle name) against('amar');
I am getting error as : The used table type doesn't support FULLTEXT indexes.
I am using mysql version 5.5.24 on wamp server.
How to solve this issue.
Thank you
before Mysql 5.6, full text search is supported by only myisam engine not innodb, it seems you are using innodb engine for this table.
Even it seems that you did not create full text index on table otherwise you will get error at that time also...
full text index is different from btree default index.

Aruba-MySQL: can't create/change table to engine=INNODB

We have our database stored in aruba (mysql.aruba.it) where there is a table called "task". Because of many changes in the requirements we decided to drop the table and create it again from 0 with different fields and constraints. The problem is that MySQL/Aruba won't let us create the table anymore. Or better, we can create another task table only with engine MyISAM but we need INNODB because we will use contraints and foreign keys in the table. So I have tried to create a MyISAM table and then convert it into INNODB but I get an error like this:
ALTER TABLE `task` ENGINE = INNODB
#1025 - Error on rename of './Sql689345_4/#sql-6962_1891f' to './Sql689345_4/task' (errno: -1)
I don't know why there is this problem with this table: for other tables we have we can drop them and re-create them as many times as we want.
Is there a way to fix it?
Not all Aruba databases accept InnoDB tables; verify on the "Engine" link inside the control panel if INNODB is in white (engaged) or in grey (disengaged); if your database does not support InnoDB tables you can ask a new database supporting InnoDB for free, opening an assistance ticket.
In order to convert a table from MyIsam to InnoDB, is not a good practice to use the command ALTER TABLE, I suggest to export your table in a .sql file, CREATE a new table with the required structure and the InnoDB engine, and then import the data from .sql file.

Alter row_format to dynamic

What is the MySQL statement to alter the row_format to dynamic?
I am not sure how I am supposed to do it (i.e. using the information_schema or by using a table ALTER).
try
ALTER TABLE `test` ROW_FORMAT=DYNAMIC;
The method I've used, based on the current Oracle docs, is because the COMPACT tables I have were only set based on the default, which has now changed. This is on a MariaDB 10.2 system for me, but will work on modern MySQL systems.
Specifically, ensure default is DYNAMIC (or the format you need):
SET GLOBAL innodb_default_row_format=DYNAMIC;
Then OPTIMIZE the tables you need to change;
OPTIMIZE TABLE database.tablename;
This works, because the row_format is updated to the server default on an "operation that rebuilds a table silently", to quote the documentation.

create db as innodb in mysql

I knew that we can set innodb as engine tables. But can we add this same create database query.I tried this:create database 'mydb' set engine='Innodb' but it throws error. Thanks.
That concept does not exist: databases don't have engines; tables do.
Update:
The closest you can achieve is to change the default engine for CREATE TABLE statements that don't specify one, it's explained at: http://dev.mysql.com/doc/refman/5.1/en/storage-engine-setting.html

How do I know if a mysql table is using myISAM or InnoDB Engine?

In MySQL, there is no way to specify a storage engine for a certain database, only for single tables. However, you can specify a storage engine to be used during one session with:
SET storage_engine=InnoDB;
So you don't have to specify it for each table.
How do I confirm, if indeed all the tables are using InnoDB?
If you use SHOW CREATE TABLE, you have to parse the engine out of the query.
Selecting from the INFORMATION_SCHEMA database is poor practice, as the devs reserve the right to change its schema at any time (though it is unlikely).
The correct query to use is SHOW TABLE STATUS - you can get information on all the tables in a database:
SHOW TABLE STATUS FROM `database`;
Or for a specific table:
SHOW TABLE STATUS FROM `database` LIKE 'tablename';
One of the columns you will get back is Engine.
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'db name' AND ENGINE != 'InnoDB'
show create table <table> should do the trick.