Bug #69876 Unable to get the database encoded name in MySQL 5.6

Submitted: 31 Jul 2013 5:22 Modified: 13 Nov 2013 13:25
Reporter: vaibhav fursule Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.6.12/13, 5.7.2-m12 OS:Linux (Ubuntu 12.04)
Assigned to: Paul DuBois CPU Architecture:Any

[31 Jul 2013 5:22] vaibhav fursule
Description:
I do run the following command to get the mysql encoded db name if it contains some special character. 

This works fine for MySQL 5.5 or lower versions 

Server version:	 5.5.31-0ubuntu0.12.04.2-log (Ubuntu) 

mysql> SELECT BINARY(CAST('db-name' AS CHAR CHARACTER SET FILENAME)); 
+--------------------------------------------------------+ 
| BINARY(CAST('db-name' AS CHAR CHARACTER SET FILENAME)) | 
+--------------------------------------------------------+ 
| db@002dname | 
+--------------------------------------------------------+ 
1 row in set (0.00 sec) 

In MySQL 5.6, The above command will not give the encrypt db name. 

Server version:	 5.6.10-log MySQL Community Server (GPL) 

mysql> SELECT BINARY(CAST('db-name' AS CHAR CHARACTER SET FILENAME)); 
+--------------------------------------------------------+ 
| BINARY(CAST('db-name' AS CHAR CHARACTER SET FILENAME)) | 
+--------------------------------------------------------+ 
| db-name | 
+--------------------------------------------------------+ 
1 row in set (0.00 sec) 

Any body has idea how to get the encoded db name in mysql 5.6. 

There was bug with XtraBackup/MEB which does not do the backup of the database or tables if it contains the special character. If we pass the encoded db name/table names then backup works fine . 

However with mysql 5.6 it do the backup of database/tables without passing the encoded db name/tables but the backup dir creates the database directory as encoded name. I would like to how to get the encoded db name in mysql 5.6. I need to update my index file with backup content and I need this info during the restore.

How to repeat:
Server version:	 5.6.10-log MySQL Community Server (GPL) 

mysql> SELECT BINARY(CAST('db-name' AS CHAR CHARACTER SET FILENAME)); 
+--------------------------------------------------------+ 
| BINARY(CAST('db-name' AS CHAR CHARACTER SET FILENAME)) | 
+--------------------------------------------------------+ 
| db-name | 
+--------------------------------------------------------+ 
1 row in set (0.00 sec) 

The above 'db-name' should output as "db@002dname"
[31 Jul 2013 6:49] MySQL Verification Team
Hello Vaibhav,

Thank you for the bug report. 
Verified as described.

Thanks,
Umesh
[13 Nov 2013 13:25] Paul DuBois
This has been judged not a bug because the filename character set is for internal use only; or rather, as a docs omission.

I have added a note to
http://dev.mysql.com/doc/refman/5.6/en/show-character-set.html:

The filename character set is for internal use only; consequently, SHOW CHARACTER SET does not display it.

Reference:

About 'FILENAME' Charset
According to Barkov for
Bug #11748858 - USE OF CHARACTER SET AND COLLATE AS 'FILENAME' SHOWS UNUSUAL
BEHAVIOUR.
"filename is an internal character set and is not supposed to
be used as a database default character set or in SET NAMES by a normal
user."

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.055 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.