CREATE SERVER Statement Consider the following procedure, which displays a count of the number of MySQL accounts listed in the mysql.user  system table: The procedure is assigned a  DEFINER  account of  ’admin’@’localhost’  no matter which user defines it. It executes with the privileges of that account no matter which user invokes it (because the default security characteristic is  DEFINER ). The procedure succeeds or fails depending on whether invoker has the  EXECUTE  privilege for it and  ’admin’@’localhost’  has the  SELECT  privilege for the  mysql.user table. Now suppose that the procedure is defined with the  SQL SECURITY INVOKER  characteristic: The procedure still has a  DEFINER  of  ’admin’@’localhost’ , but in this case, it executes with the privileges of the invoking user. Thus, the procedure succeeds or fails depending on whether the invoker has the  EXECUTE  privilege for it and the  SELECT  privilege for the  mysql.user  table. The server handles the data type of a routine parameter, local routine variable created with  DECLARE , or function return value as follows: If  CHARACTER SET  and  COLLATE  are not present, the database character set and collation in effect at routine creation time are used. To avoid having the server use the database character set and collation, provide an explicit  CHARACTER SET  and a  COLLATE  attribute for character data parameters. If you alter the database default character set or collation, stored routines that are to use the new database defaults must be dropped and recreated. The database character set and collation are given by the value of the  character_set_database and  collation_database  system variables. For more information, see Section 10.3.3, “Database Character Set and Collation” . 13.1.18 CREATE SERVER Statement CREATE SERVER  server_name FOREIGN DATA WRAPPER  wrapper_name OPTIONS ( option  [,  option ] ...) option : { HOST  character-literal | DATABASE  character-literal 2535 •For character data types, if  CHARACTER SET  is includedd in the declaration, the specified character set and its default collation is used. If the  COLLATE  attribute is also present, that collation is used rather than the default collation. •Only scalar values can be assigned. For example, a statement such as  SET x = (SELECT 1, 2)  is invalid. •Assignments are checked for data type mismatches and overflow. Conversion and overflow problems result in warnings, or errors in strict SQL mode. CREATE DEFINER = ’admin’@’localhost’ PROCEDURE account_count() SQL SECURITY INVOKER BEGIN SELECT ’Number of accounts:’, COUNT(*) FROM mysql.user; END; CREATE DEFINER = ’admin’@’localhost’ PROCEDURE account_count() BEGIN SELECT ’Number of accounts:’, COUNT(*) FROM mysql.user; END;