Ich möchte, dies zu tun:MySQL CREATE USER mit einer Variablen?
#Variables
SET @username="jdoe", @password="secret";
# Insert a new MySQL User
CREATE USER @[email protected]'localhost' IDENTIFIED BY @password;GRANT USAGE ON *.* TO @[email protected]'localhost' IDENTIFIED BY @password WITH MAX_QUERIES_PER_HOUR 120 MAX_CONNECTIONS_PER_HOUR 60 MAX_UPDATES_PER_HOUR 60 MAX_USER_CONNECTIONS 2;
aber erhalten:
#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 '@[email protected]'localhost' IDENTIFIED BY @password' at line 2
Wie verwende ich eine Variable in der CREATE USER-Anweisung?
möglich Duplikat [Syntaxfehler von CREATE USER Variablen mit Angabe Benutzernamen und Passwort] (http://stackoverflow.com/questions/11368966/syntax-error-from -create-user-with-variables-giving-Benutzername und Passwort – aleroot
@aleroot Ich bin mir nicht sicher, dass das das gleiche Problem ist, da es sich um das Erstellen einer gespeicherten Prozedur handelt. – Nick