Bug #1175 Usernames will not converted to utf8 during connect
Submitted: 1 Sep 2003 23:44 Modified: 24 Dec 2003 5:59
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.1 OS:Linux (Linux)
Assigned to: Alexander Barkov CPU Architecture:Any

[1 Sep 2003 23:44] Georg Richter
Description:
if you add a user which name contains special chars, you can't connect with this user (except 
you encode the username to utf-8). 
 
If you can't read the special char it's an o with a slash inside :) 

How to repeat:
mysql> grant all on test to 'bjørn'@'localhost'; 
ERROR 1046 (3D000): No Database Selected 
 
Hmm.. why do I need to select a database here?! 
 
mysql> use mysql; 
Reading table information for completion of table and column names 
You can turn off this feature to get a quicker startup with -A 
 
Database changed 
mysql> grant all on test to 'bjørn'@'localhost'; 
Query OK, 0 rows affected (0.14 sec) 
 
mysql> flush privileges; 
Query OK, 0 rows affected (0.24 sec) 
 
mysql> select user from user where user like 'b%'; 
+--------+ 
| user   | 
+--------+ 
| bjÃ?rn | 
+--------+ 
1 row in set (0.44 sec) 
 
 
mysql -ubjørn now fails
[2 Sep 2003 3:52] MySQL Verification Team
You need to select database because

grant on something to ...

means that `something ` is a table. 

And a table should have a database.
[18 Dec 2003 21:16] MySQL Verification Team
Georg please test with 4.1.2. I get the below behavior:

 miguel@hegel:~/dev> /home/miguel/mysqldb-4.1/bin/mysql --defaults-file=/home/miguel/mysqldb-4.1/my.cnf -ubjørn
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.1.2-alpha-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show variables like "%cha%";
+--------------------------+------------------------------------------------+
| Variable_name            | Value                                          |
+--------------------------+------------------------------------------------+
| character_set_server     | latin1                                         |
| character_set_system     | utf8                                           |
| character_set_database   | latin1                                         |
| character_set_client     | latin1                                         |
| character_set_connection | latin1                                         |
| character-sets-dir       | /home/miguel/mysqldb-4.1/share/mysql/charsets/ |
| character_set_results    | latin1                                         |
+--------------------------+------------------------------------------------+
7 rows in set (0.02 sec)
[18 Dec 2003 22:48] Georg Richter
Miguel, 

I still can reproduce the bug with latest 4.1.2 pull.
What does SELECT CURRENT_USER() show after login?
[19 Dec 2003 4:18] MySQL Verification Team
Yes Georg I removed the anonymous user and -ubjørn can't login
anymore. You reported behavior still happens.
[24 Dec 2003 5:59] Alexander Barkov
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

I fixed the bug. But I have no ideas how to add a test for this bug :(