How to convert all tables from MyISAM into InnoDB?

Run this SQL statement (in the MySQL client, phpMyAdmin, or wherever) to retrieve all the MyISAM tables in your database. Replace value of the name_of_your_db variable with your database name. SET @DATABASE_NAME = ‘name_of_your_db’; SELECT CONCAT(‘ALTER TABLE `’, table_name, ‘` ENGINE=InnoDB;’) AS sql_statements FROM information_schema.tables AS tb WHERE table_schema = @DATABASE_NAME AND `ENGINE` = ‘MyISAM’ … Read more

How to create linked server MySQL

MySQL’s FEDERATED engine provides functionality similar to SQL Server’s Linked Server (and Oracle’s dblink) functionality, but doesn’t support connecting to vendors other than MySQL. It’s not clear from the question if you need the functionality to connect to vendors other than MySQL. You might want to look into MySQL Proxy. This doesn’t match the architecture … Read more

How to schedule a MySQL query?

you have 2 basic options (at least): 1, Take a look at Event Scheduler First create table eg. stock_dumps with fields itemcode, quantity, avgcost, ttlval,dump_date (DATETIME) CREATE EVENT `Dumping_event` ON SCHEDULE EVERY 1 DAY ON COMPLETION NOT PRESERVE ENABLE COMMENT ” DO BEGIN INSERT INTO stock_dumps(itemcode, quantity, avgcost, ttlval,dump_date) SELECT itmcode, quantity, avgcost, (avgcost * … Read more

On duplicate key ignore? [duplicate]

Would suggest NOT using INSERT IGNORE as it ignores ALL errors (ie its a sloppy global ignore). Instead, since in your example tag is the unique key, use: INSERT INTO table_tags (tag) VALUES (‘tag_a’),(‘tab_b’),(‘tag_c’) ON DUPLICATE KEY UPDATE tag=tag; on duplicate key produces: Query OK, 0 rows affected (0.07 sec)

MySQL: Error Code: 1118 Row size too large (> 8126). Changing some columns to TEXT or BLOB

I tried all the solutions here, but only this parameter innodb_strict_mode = 0 solved my day… From the manual: The innodb_strict_mode setting affects the handling of syntax errors for CREATE TABLE, ALTER TABLE and CREATE INDEX statements. innodb_strict_mode also enables a record size check, so that an INSERT or UPDATE never fails due to the … Read more