給mysql添加管理員的sql語句 SET @NEWUSER='master'; SET @NEWPASS='password'; SELECT @FF:=GROUP_CONCAT(column_name) from information_schema.columns where TABLE_NAME='User' and COLUMN_NAME not in('Host','User','Password'); www.2cto.com set @SQL=CONCAT('insert into mysql.user select \'%\',\'',@NEWUSER,'\',PASSWORD(\'',@NEWPASS,'\'),',@FF,' from mysql.user where user=\'root\';') ; PREPARE stmt from @SQL; EXECUTE stmt; DEALLOCATE PREPARE stmt; flush privileges; 作者 mrzho