I would like to create a database user using something like the following prepared statement:
DB::statement("CREATE USER ? IDENTIFIED BY ?", ['abc', 'def']);
However, attempting to run this gives me an error:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? IDENTIFIED BY ?' at line 1 (SQL: CREATE USER abc IDENTIFIED BY def)
I can create like this:
DB::statement("CREATE USER {$user} IDENTIFIED BY {$password}");
But I would prefer not to use a prepared statement, how can I achieve that?