Home
%3CLINGO-SUB%20id%3D%22lingo-sub-916912%22%20slang%3D%22en-US%22%3ETips%20and%20Tricks%20in%20using%20mysqldump%20and%20mysql%20restore%20to%20Azure%20Database%20for%20MySQL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-916912%22%20slang%3D%22en-US%22%3E%3CP%3EWhile%20importing%20data%20into%20Azure%20Database%20for%20MySQL%2C%20errors%20may%20occur.%20This%20blog%20will%20walk%20through%20common%20issues%20that%20you%20may%20face%20and%20how%20to%20resolve%20it.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CSTRONG%3E%20Access%20denied%3B%20you%20need%20(at%20least%20one%20of)%20the%20SUPER%20privilege(s)%20for%20this%20operation%3A%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EError%3C%2FU%3E%3C%2FSTRONG%3E%3CSTRONG%3E%3CEM%3E%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FSTRONG%3E%3CEM%3EERROR%201227%20(42000)%20at%20line%20101%3A%20Access%20denied%3B%20you%20need%20(at%20least%20one%20of)%20the%20SUPER%20privilege(s)%20for%20this%20operation%3CBR%20%2F%3EOperation%20failed%20with%20exitcode%201%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EIssue%3C%2FU%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EImporting%20a%20dump%20file%20that%20contains%20%3CA%20href%3D%22https%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.7%2Fen%2Fcreate-procedure.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Edefiners%3C%2FA%3E%20will%20result%20in%20the%20above%20error.%20As%20all%20of%20us%20know%2C%20only%20super%20users%20can%20perform%20and%20create%20definers%20in%20other%20schemas.%20Azure%20Database%20for%20MySQL%20is%20a%20managed%20PaaS%20solution%20and%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fconcepts-limits%23unsupported-1https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fconcepts-limits%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ESUPER%20privileges%20is%20restricted%3C%2FA%3E.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSTRONG%3E%3CU%3ESolution%3C%2FU%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EEither%20replace%20the%20definers%20with%20the%20name%20of%20the%20admin%20user%20that%20is%20running%20the%20import%20process%20or%20remove%20it.%3C%2FP%3E%0A%3CP%3EThe%20admin%20user%20can%20grant%20privileges%20to%20create%20or%20execute%20procedures%20by%20running%20%3CSTRONG%3E%3CEM%3EGRANT%20%3C%2FEM%3E%3C%2FSTRONG%3Ecommand%20as%20in%20the%20following%20examples%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CEM%3EGRANT%20CREATE%20ROUTINE%20ON%20mydb.*%20TO%20'someuser'%40'somehost'%3B%20%3CBR%20%2F%3EGRANT%20EXECUTE%20ON%20PROCEDURE%20mydb.myproc%20TO%20'someuser'%40'somehost'%3B%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EExample%3C%2FU%3E%3C%2FSTRONG%3E%3CSTRONG%3E%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EBefore%3A%3C%2FP%3E%0A%3CP%3EDELIMITER%20%3B%3B%3C%2FP%3E%0A%3CP%3E%2F*!50003%20CREATE*%2F%20%2F*!50017%20DEFINER%3D%60root%60%40%60127.0.0.1%60*%2F%20%2F*!50003%20%E2%80%A6%E2%80%A6%3C%2FP%3E%0A%3CP%3EDELIMITER%20%3B%3C%2FP%3E%0A%3CP%3EAfter%3A%3C%2FP%3E%0A%3CP%3EDELIMITER%20%3B%3B%3C%2FP%3E%0A%3CP%3E%2F*!50003%20CREATE*%2F%20%2F*!50017%20DEFINER%3D%60AdminUserName%60%40%60ServerName%60*%2F%20%2F*!50003%20%E2%80%A6%E2%80%A6%3C%2FP%3E%0A%3CP%3EDELIMITER%20%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%222%22%3E%0A%3CLI%3E%3CSTRONG%3E%20importing%20triggers%20while%20binary%20logging%20is%20enabled%3A%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EError%3C%2FU%3E%3C%2FSTRONG%3E%3CSTRONG%3E%3CEM%3E%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FSTRONG%3E%3CEM%3EERROR%201419%20(HY000)%20at%20line%20101%3A%20You%20do%20not%20have%20the%20SUPER%20privilege%20and%20binary%20logging%20is%20enabled%20(you%20*might*%20want%20to%20use%20the%20less%20safe%20log_bin_trust_function_creators%20variable)%3CBR%20%2F%3EOperation%20failed%20with%20exitcode%201%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EIssue%3C%2FU%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EImporting%20a%20dump%20file%20that%20contains%20triggers%20will%20result%20in%20the%20above%20error%20if%20binary%20logging%20is%20enabled.%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3ESolution%3C%2FU%3E%3C%2FSTRONG%3E%3CBR%20%2F%3ETo%20mitigate%20the%20issue%2C%20you%20need%20to%20enable%20the%20parameter%20%E2%80%9Clog_bin_trust_function_creators%E2%80%9D%20from%20Azure%20portal%20parameters%20blade.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%223%22%3E%0A%3CLI%3E%3CSTRONG%3E%20storage%20engine%20not%20supported%3A%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EError%3C%2FU%3E%3C%2FSTRONG%3E%3CSTRONG%3E%3CEM%3E%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FSTRONG%3E%3CEM%3EERROR%201030%20(HY000)%20at%20line%20114%3A%20Got%20error%201%20from%20storage%20engine%3CBR%20%2F%3EOperation%20failed%20with%20exitcode%201%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CBR%20%2F%3E%3CU%3EIssue%3C%2FU%3E%3CBR%20%2F%3E%3C%2FSTRONG%3EYou%20will%20see%20the%20above%20error%20when%20you%20use%20a%20storage%20engine%20other%20than%20InnoDB%20and%20MEMORY.%20Read%20more%20on%20support%20engine%20types%20here%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fconcepts-limits%23storage-engine-support%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EStorage%20engine%20support%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3ESolution%3CBR%20%2F%3E%3C%2FU%3E%3C%2FSTRONG%3EBefore%20the%20import%20process%20make%20sure%20that%20you%20are%20using%20a%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fconcepts-limits%23supported%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Esupported%20engine%20type%3C%2FA%3E%3B%20InnoDB%20and%20MEMORY%20are%20the%20only%20supported%20engine%20types%20in%20Azure%20Database%20for%20MySQL.%3CBR%20%2F%3EIf%20you%20dumped%20the%20data%20from%20a%20different%20engine%20type%2C%20edit%20the%20file%20and%20replace%20the%20storage%20engine.%20For%20example%2C%20exchange%20ENGINE%3DMYISAM%20with%20ENGINE%3DInnoDB.%3C%2FP%3E%0A%3CP%3ENote%3A%20You%20can%20always%20dump%20the%20schema%20first%20using%20the%20command%3A%20%3CSTRONG%3E%3CEM%3Emysqldump%20--no-data%20option%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20and%20then%20dump%20the%20data%20using%20option%3A%20%3CSTRONG%3E%3CEM%3Emysqldump%20--no-create-info%20option%3C%2FEM%3E%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EExample%20%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EBefore%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ECREATE%20TABLE%20%60MyTable%60%20(%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%60ID%60%20bigint(20)%20NOT%20NULL%20AUTO_INCREMENT%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%60DeviceID%60%20varchar(50)%20NOT%20NULL%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20PRIMARY%20KEY%20(%60ID%60)%3C%2FP%3E%0A%3CP%3E)%20ENGINE%3D%3CSTRONG%3EMyISAM%3C%2FSTRONG%3E%20DEFAULT%20CHARSET%3Dutf8%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EAfter%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ECREATE%20TABLE%20%60MyTable%60%20(%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%60ID%60%20bigint(20)%20NOT%20NULL%20AUTO_INCREMENT%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%60DeviceID%60%20varchar(50)%20NOT%20NULL%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20PRIMARY%20KEY%20(%60ID%60)%3C%2FP%3E%0A%3CP%3E)%20ENGINE%3D%3CSTRONG%3EInnoDB%3C%2FSTRONG%3E%20DEFAULT%20CHARSET%3Dutf8%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%224%22%3E%0A%3CLI%3E%3CSTRONG%3E%20InnoDB%20storage%20engine%20row%20format%3A%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EError%3C%2FU%3E%3C%2FSTRONG%3E%3CSTRONG%3E%3CEM%3E%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FSTRONG%3E%3CEM%3EERROR%201031%20(HY000)%20at%20line%20114%3A%20Table%20storage%20engine%20for%20'mytable'%20doesn't%20have%20this%20option%3CBR%20%2F%3EOperation%20failed%20with%20exitcode%201%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EIssue%3C%2FU%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EIn%20Azure%20Database%20for%20MySQL%2C%20four%20row%20format%20options%20are%20supported%3A%20DYNAMIC%2C%20COMPACT%20and%20REDUNDANT%2C%20the%20COMPRESSED%20row%20format%20is%20supported%20under%20certain%20conditions.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3ESolution%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EWe%20support%20compressed%20format%20on%20General%20Purpose%20or%20Memory%20Optimized.%20Customer%20needs%20to%20enable%20the%20parameter%20%E2%80%9Cinnodb_file_per_table%E2%80%9D%20from%20Azure%20portal%20parameters%20blade%2C%20and%20key_block_size%20must%20be%208%20or%20greater%20than%208.%20In%20default%2C%20key_block_size%20is%208.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPlease%20visit%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fconcepts-migrate-dump-restore%23performance-considerations%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPerformance%20considerations%20guide%3C%2FA%3E%20for%20%3CSTRONG%3Ebest%20practices%3C%2FSTRONG%3E%20while%20migrating%20into%20Azure%20Database%20for%20MySQL.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThank%20You%20!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-916912%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%20Denied%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EBackup%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Edatabase%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Edefiner%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Einnodb%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMigration%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMyISAM%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMySQL%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Emysqldump%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

While importing data into Azure Database for MySQL, errors may occur. This blog will walk through common issues that you may face and how to resolve it.

  1. Access denied; you need (at least one of) the SUPER privilege(s) for this operation:

Error
ERROR 1227 (42000) at line 101: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
Operation failed with exitcode 1

 

Issue
Importing a dump file that contains definers will result in the above error. As all of us know, only super users can perform and create definers in other schemas. Azure Database for MySQL is a managed PaaS solution and SUPER privileges is restricted.

Solution
Either replace the definers with the name of the admin user that is running the import process or remove it.

The admin user can grant privileges to create or execute procedures by running GRANT command as in the following examples:

GRANT CREATE ROUTINE ON mydb.* TO 'someuser'@'somehost';
GRANT EXECUTE ON PROCEDURE mydb.myproc TO 'someuser'@'somehost';

 

Example:

Before:

DELIMITER ;;

/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`127.0.0.1`*/ /*!50003 ……

DELIMITER ;

After:

DELIMITER ;;

/*!50003 CREATE*/ /*!50017 DEFINER=`AdminUserName`@`ServerName`*/ /*!50003 ……

DELIMITER ;

 

  1. importing triggers while binary logging is enabled:

Error
ERROR 1419 (HY000) at line 101: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
Operation failed with exitcode 1

 

Issue
Importing a dump file that contains triggers will result in the above error if binary logging is enabled.

Solution
To mitigate the issue, you need to enable the parameter “log_bin_trust_function_creators” from Azure portal parameters blade.

 

  1. storage engine not supported:

Error
ERROR 1030 (HY000) at line 114: Got error 1 from storage engine
Operation failed with exitcode 1


Issue
You will see the above error when you use a storage engine other than InnoDB and MEMORY. Read more on support engine types here: Storage engine support

 

Solution
Before the import process make sure that you are using a supported engine type; InnoDB and MEMORY are the only supported engine types in Azure Database for MySQL.
If you dumped the data from a different engine type, edit the file and replace the storage engine. For example, exchange ENGINE=MYISAM with ENGINE=InnoDB.

Note: You can always dump the schema first using the command: mysqldump --no-data option, and then dump the data using option: mysqldump --no-create-info option

Example :

Before:

CREATE TABLE `MyTable` (

  `ID` bigint(20) NOT NULL AUTO_INCREMENT,

  `DeviceID` varchar(50) NOT NULL,

  PRIMARY KEY (`ID`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8;

 

After:

CREATE TABLE `MyTable` (

  `ID` bigint(20) NOT NULL AUTO_INCREMENT,

  `DeviceID` varchar(50) NOT NULL,

  PRIMARY KEY (`ID`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

 

  1. InnoDB storage engine row format:

Error
ERROR 1031 (HY000) at line 114: Table storage engine for 'mytable' doesn't have this option
Operation failed with exitcode 1

 

Issue
In Azure Database for MySQL, four row format options are supported: DYNAMIC, COMPACT and REDUNDANT, the COMPRESSED row format is supported under certain conditions.

 

Solution

We support compressed format on General Purpose or Memory Optimized. Customer needs to enable the parameter “innodb_file_per_table” from Azure portal parameters blade, and key_block_size must be 8 or greater than 8. In default, key_block_size is 8.

 

Please visit the Performance considerations guide for best practices while migrating into Azure Database for MySQL.

 

Thank You !