How to convert MAIN mysql database to InnoDB from MyIsam - mysql

I am trying to manage mysql group replication and I noticed a problem when manipulating users and grants. 10 of the main mysql tables in the main mysql database are MyIsam. So I cant add databases or user permissions because they fail and wont replicate. Master-master group replication requirs everything InnoDB.
ALTER TABLE works fine on regular custom databases/tables but how do you fix this on the main mysql database?
I tried this but they all fail:
ALTER TABLE mysql.db ENGINE = InnoDB;
ALTER TABLE mysql.tables_priv ENGINE = InnoDB;
ALTER TABLE mysql.user ENGINE = InnoDB;
ERROR: ERROR 1726 (HY000): Storage engine 'InnoDB' does not support system tables.
Another error running CREATE USER...
[ERROR] Plugin group_replication reported: 'Table db does not use the InnoDB storage engine. This is not compatible with Group Replication'
ERROR 3098 (HY000): The table does not comply with the requirements by an external plugin group_replication.
Server version: 5.7.23-log MySQL Community Server

DO NOT CHANGE THE ENGINE FOR SYSTEM TABLES
MySQL has not yet changed the code enough to allow for mysql.* to be anything other than MyISAM. MySQL 8.0 makes the change by turning the tables (the "data dictionary") into a InnoDB tables, with radically different structure and capabilities.
Since you are at 5.7.23, you are only one (big) step away from 8.0.xx. Consider upgrading.
Replication works with MyISAM tables, but clustering replication does not -- Galera and InnoDB Cluster deal with those system MyISAM tables in other ways. See the documentation on what happens with GRANT, CREATE USER, etc. Do not use UPDATE and INSERT to manipulate the login-related tables.
(The Author of this Question seems to have fixed the problem by uninstalling a plugin.)

Related

When creating a mysql table in AWS RDS with ENGINE=MyISAM, it overrides it with InnoDB

I am using '5.7.mysql_aurora.2.10.2' version of AWS Aurora MySQL instance and I have trying to create Log table with innoDB engine so I can Log things (INSERT query) combined with SIGNAL command. Something like this:
INSERT INTO Log(type, info, date) VALUES("ERROR", "Error happened...!", CURRENT_TIMESTAMP());
SIGNAL CUSTOM_EXCEPTION SET MESSAGE_TEXT = "Error happened...";
But as I found out, SIGNAL basically rolls back everything including my INSERT statement. I have been trying to figure out the workaround and I stumbled upon the DB tables with engine MyISAM which should solve my problem. So I decided to create a table for testing:
CREATE TABLE t (i INT) ENGINE = MYISAM;
And for some reason, the engine keeps being InnoDB. I have tested on my local instance and it works fine but as soon as I try it on my RDS database, it keeps changing back. I have tried to use ALTER TABLE but it doesn't work.
Is there a possibility that RDS has some configuration that doesn't let me use any other engine other than InnoDB?
Amazon Aurora only supports InnoDB.
https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Reference.html says:
Aurora MySQL clusters use the InnoDB storage engine for all of your data.
This is by design. They implemented their distributed storage by modifying the InnoDB storage engine. Aurora simply doesn't work with any other storage engine, so they disabled the capability to specify the storage engine for a table.
Aurora is not MySQL.

mysql innodb cluster : possible to upgrade myisam to innodb on live cluster?

Hello just wondering because all our databases are innodb but mysql db is not.. so when I create a user is not replicating.. so instead of having to create the user on each node, wonder how hard will it be to upgrade the mysql.user table to innodb. thanks

Possible to simulate mysql server in memory?

I wrote some functions that work with SQL. I test the functions using testthat and an in memory SQLite database. However, some functions cannot be tested using SQLite because SQLite does not support the ALTER TABLE command.
Is there some way to simulate a mySQL database in memory the same way that one can simulate a SQLite?
> DBI::dbConnect(RSQLite::SQLite(), ":memory:")
<SQLiteConnection>
Path: :memory:
Extensions: TRUE
> DBI::dbConnect(RMySQL::MySQL(), ":memory:")
Error in .local(drv, ...) :
Failed to connect to database: Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
If not, how does one write automatic tests for mySQL functions?
You can't make a whole MySQL instance run in memory like the SQLite :memory: option. MySQL is designed to be a persistent database server, not an ephemeral embedded database like SQLite.
However, you can use MySQL's MEMORY Storage Engine for individual tables:
CREATE TABLE MyTable ( ...whatever... ) ENGINE=MEMORY;
The equivalent in RMySQL seems to be the dbWriteTable() method, but as far as I can tell from documentation, you can't specify the ENGINE when creating a table with this method. You'll have to create the table manually in the MySQL client if you want to use the MEMORY engine.
But you should be aware that every storage engine has some subtle different behavior. If any of your tests depend on features of InnoDB, you won't be able to simulate them with the MEMORY storage engine (e.g. row-level locking, foreign keys, fulltext search).
Read the manual on the MEMORY storage engine: https://dev.mysql.com/doc/refman/5.7/en/memory-storage-engine.html
P.S.: Ignore the suggestions on that manual page to use NDB Cluster. It may be faster, but it requires multiple servers and special database design to achieve that performance. It's much harder to set up.

Can the MySQL system database tables be converted to InnoDB?

I've installed MySQL 5.5 recently. I'm using InnoDB as the engine for all my databases. I noticed that the mysql database default and all of it's tables (user, db, etc...) are MyISAM. Is there any reason they cannot / should not be InnoDB? Does anyone know if MySQL requires the mysql db to be MyISAM?
Warning
Do not convert MySQL system tables in the mysql database from MyISAM to InnoDB tables! This is an unsupported operation. If you do this, MySQL does not restart until you restore the old system tables from a backup or re-generate them with the mysql_install_db script.
http://dev.mysql.com/doc/refman/5.0/en/innodb-restrictions.html

Changing the engine to InnoDB from MyISAM is not working

I am trying to change the table engine from MyISAM to INNODB. I am using the
alter table tablename ENGINE=INNODB
command. I am not getting any errors or warnings on the mysql side. I also commented the
skip-innodb
line in my.cnf file. So when I do a
show variables like 'have-innodb%'
it gives me a "YES". Also just to be on the safe side, I also deleted my ib_logfile0 and ib_logfile1 and restarted my mysql server.
But it still does not change the engine. I also did a show engines, and it shows innodb as one of the available engines.
Also these tables are full of data and have around 5000 rows, so is changing the engine type when a table has data, would that be the problem??
What could the missing link be??
Are you able to restart the server? If so, the error log will tell you if it had problems initialising the InnoDB engine.
Is this the first InnoDB table in your db? If so, you may have forgotten to create your ibdata files.
Does the table use fulltext indexing or other InnoDB-incompatible features?