From: Ludovic CHEVALIER Date: Tue, 16 Apr 2013 15:05:28 +0000 (+0200) Subject: Modifications : etc/sv/mysql/configure.sh X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/User:Test/%27http:/jquery.khurshid.com/ifixpng.php/%40%20%27info_etape_suivante_2%27%20=%3E%20%27You%20can%20move%20on%20to%20the%20next%20step.%27%2C%20%27info_exceptions_proxy%27%20=%3E%20%27Exceptions%20for%20the%20proxy%27%2C%20%27info_exportation_base%27%20=%3E%20%27export%20database%20to%20%40archive%40%27%2C-%27info_facilite_suivi_activite%27%20=%3E%20%27To%20simplify%20monitoring%20of%20the%20site/%27s%20editorial;-%20%20activities%2C%20SPIP%20can%20send%20rmail%20notifications%2C%20e.g.%20to%20an%20editors/%27%20mailing%20list%2C%20%27info_facilite_suivi_activite%27%20=%3E%20%27To%20simplify%20monitoring%20of%20the%20site%C3%A2%C2%80%C2%99s%20editorial;%20%20%20activities%2C%20SPIP%20can%20send%20rmail%20notifications%2C%20e.g.%20to%20an%20editors%C3%A2%C2%80%C2%99%20mailing%20list%2C%20%20%20of%20publication%20requests%20and%20article%20validations.%27%2C%20%27info_fichiers_authent%27%20=%3E%20%27Authentication%20file?a=commitdiff_plain;h=95b7f564247d2e3a2e7dc051bf3366f7542e48ef;p=lhc%2Fateliers.git Modifications : etc/sv/mysql/configure.sh --- diff --git a/etc/sv/mysql/configure.sh b/etc/sv/mysql/configure.sh index cf8e41d..c576325 100644 --- a/etc/sv/mysql/configure.sh +++ b/etc/sv/mysql/configure.sh @@ -69,7 +69,7 @@ sudo mysql -u root --batch --verbose <<-EOF DELETE FROM mysql.user WHERE user = 'root' and plugin = ''; DROP PROCEDURE IF EXISTS mysql.create_user_mysql; DELIMITER // - CREATE PROCEDURE mysql.create_user_mysql () + CREATE PROCEDURE mysql.create_user_mysql () BEGIN IF NOT (EXISTS (SELECT User FROM mysql.user @@ -85,5 +85,21 @@ sudo mysql -u root --batch --verbose <<-EOF UPDATE mysql.user SET grant_priv='Y',super_priv='Y' WHERE user='mysql'; DELETE FROM mysql.db WHERE user = ''; DELETE FROM mysql.user WHERE user = ''; + DROP PROCEDURE IF EXISTS mysql.create_user; + CREATE PROCEDURE mysql.create_user (username VARCHAR(16), hostname VARCHAR(60)) + BEGIN + IF NOT (EXISTS (SELECT User + FROM mysql.user + WHERE User = username + AND Host = hostname + LIMIT 1)) + THEN + SET @QUERY = CONCAT("CREATE USER ", username, "@", hostname, " IDENTIFIED WITH auth_socket"); + PREPARE stmt FROM @QUERY; + EXECUTE stmt; + END IF; + END; + // + DROP PROCEDURE IF EXISTS mysql.show_user; FLUSH PRIVILEGES; EOF