enter image description here]1]1I am trying to pass variable value in create database statement using SET variable. And then trying execute that statement using PREPARE which throws an error. What am I doing wrong here?
SET @dbname := 'mydb';
SET @query := CONCAT('CREATE DATABASE `', @dbname, '`');
PREPARE stmt FROM @query;
EXECUTE stmt USING @query;
DEALLOCATE PREPARE stmt;
Error:
1 queries executed, 0 success, 1 errors, 0 warnings
Query: PREPARE stmt_1 from @query
Error Code: 1295
This command is not supported in the prepared statement protocol yet