Bug #63962 CREATE SERVER still not converting hostnames to lower case
Submitted: 8 Jan 2012 20:10 Modified: 8 Jan 2012 20:15
Reporter: Hartmut Holzgraefe Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.1.61 OS:Any
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D3 (Medium)

[8 Jan 2012 20:10] Hartmut Holzgraefe
Description:
Since 5.1.53 (with the fix for Bug #36742) all host names written to system tables by administrative commands should be converted to lower case form before hitting the storage layer (as host names are actually case insensitive).

CREATE SERVER still stores host names with upper case characters as-is 

How to repeat:
mysql> CREATE SERVER FooBar FOREIGN DATA WRAPPER mysql OPTIONS (USER 'Remote', HOST 'FooBar', DATABASE 'test');
Query OK, 1 row affected (0,00 sec)

mysql> select Server_Name, Host FROM mysql.servers;
+-------------+--------+
| Server_Name | Host   |
+-------------+--------+
| FooBar      | FooBar |
+-------------+--------+
1 row in set (0,00 sec)

Suggested fix:
Convert host names for mysql.servers to lower case before actually hitting the table like it is done with the other system tables since 5.1.53
[8 Jan 2012 20:15] Valeriy Kravchuk
Thank you for the bug report. Verified with 5.1.61 on Mac OS X:

macbook-pro:5.1 openxs$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.61-debug Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE SERVER FooBar FOREIGN DATA WRAPPER mysql OPTIONS (USER
    -> 'Remote', HOST 'FooBar', DATABASE 'test');
Query OK, 1 row affected (0.04 sec)

mysql> select Server_Name, Host FROM mysql.servers;
+-------------+--------+
| Server_Name | Host   |
+-------------+--------+
| FooBar      | FooBar |
+-------------+--------+
1 row in set (0.00 sec)

mysql> create user u1@'FooBar';
Query OK, 0 rows affected (0.06 sec)

mysql> select user, host from mysql.user where user like 'u1%';
+------+--------+
| user | host   |
+------+--------+
| u1   | foobar |
+------+--------+
1 row in set (0.02 sec)