Thanks pan64, I read that page before posting my question here. It was not much help for me because I wanted to create database desperately with these special characters (I did not read TB0ne's answer
Thanks TB0ne for your accurate suggestion.
We use phpmyadmin as a mysql client in our organization. Phpmyadmin allows user to create database with these special characters. The problem came forward when a developer created a database name "vpc-1.2 3
" (Now I understand how dangerous name was it), generally developers took back up of their all databases frequently using import export facility of phpmyadmin. When I studied it deeply, I found phpmyadmin converted a space ( ) into underscore (_) in the name of exported sql file. Actually problem was not found yet because developer can import any sql file into any database, it is not necessary that sql file name and database name should be same.That's why developer did not know that the sql file name was "vpc-1.2_3.sq
l" and database name was still "vpc-1.2 3
Developers run a script frequently which saves every database of phpmyadmin individually in a directory (Ex- database-name1.sql, database-name2.sql, database-name3.sql)
The problem was found when a developer's all mysql databases are dropped , the phpmyadmin was completely empty.
There was another script which imports all databases from sql files. First it creates all databases then it imports them.
Since our script exports sql files and the name of sql file is same as name of the database so it is easy for us to create database and import them using script.
# mysql -h 127.0.0.1 -u root -p'' -e "CREATE DATABASE $var;"
# mysql "$var" < "/path of/sql/file"
Now sql file name contains hyphens and dots that's why variable contains these special characters but create database does not allow with these characters so simply it does create the database and when database is not created it does not import the sql file in it.
That the problem developer reported
"Your script does not import all databases in phpmyadmin, I have to import 7 databases manually. Here are the list of databases which are skipped."
and in the list, the name was there vpc-1.2 3
--Thanks & Kind Regards