Is this a mysql bug, or da-mysql problem?

Richard G

Verified User
Joined
Jul 6, 2008
Messages
13,530
Location
Maastricht
This night I upgraded MySQL 5.1.62 to 5.1.63 using custombuild 1.2.
I got these kind of error notices:
mysqldump: Got error: 1049: Unknown database 'user_hr@002dsatservice' when selecting the database

Now on investigating via Directadmin logging in to the users account, this database was called "user_hr-002dsatservice" but when looking in /var/lib/mysql the database was called like in the error notice so "user_hr@002dsatservice".

In /var/lib/mysql there were a couple more with those @ signs in them. When I had a look in the accounts on DA, they were all databases with a minus sign (so a - sign) in the name.

This - will be translated in the OS to @ for some reason, this was probably causing those error notices like above.

Is this a mysql bug or a DA problem? And doesn't this need to be fixed?

I haven't seen this happening with the previous mysql update.
 
I have the same problem. It is not a new problem. My previous investigation is that this is databases that my useres created with invalid character in database name. The problem is that DirectAdmin accept the invalid characters, but the database will then not show up in DirectAdmin and phpMyAdmin. However you will find them in /var/lib/mysql

You can recreate the problem by creating a new database in DirectAdmin as a regular user, you create the database name with @ character. You will then find the database in /var/lib/mysql , but you will not find it in DirectAdmin and phpMyAdmin - and of course it will also generate the error when upgrading MySQL and doing a mysqldump

I think it is a bug, I think DirectAdmin should not attempt to create the database when user enter invalid character like @
 
I think it's a bug too.

Did you already send the thread link to DA staff or should I do it? And if I should do it, how do I do that?
 
Thanks for the report.

I've updated custombuild 1.1, 1.2 and 2.0 with new code that uses the mysql call "SHOW DATABASES" instead of the listing of /var/lib/mysql.

The characters such as '-' are allowed in the db names, cb was just not getting the list in the correct format.

The changes are in files1, please allow 24 hours for rsync propagation to the other mirrors.

John
 
John, please try to create a database in DirectAdmin panel with @ in the databasename. Then you will see it is created, but it will not exist in DirectAdmin panel and phpMyAdmin. So that is a bug.

Please make change in DirectAdmin control panel so that @ is not accepted in the text input when creating a database, or make the fix so that the database is not created when you use @ in database name.

It is problematic that users create databases with @ wich then is created in /var/lib/mysql - they should not be created!
 
The characters such as '-' are allowed in the db names
Yes, but the strange thing is, dat a '-' character will become a @ character in /var/lib/mysql.

If you make a database called user_db-stuff then in /var/lib/mysql it will be called user_db@stuff and I presume this is not working as designed?
 
Hello,

With @ in the database name, DA does block it:
Code:
Error creating the database

Details

Invalid Database Name
however, the issue mentioned above where @002 is in the directory name, is the new representation of the - character (mysql 5.1+).
So user_db-dash is stored on disk as /var/lib/mysql/user_db@002dash, but the DB name is still user_db-dash. This is normal.

The mentioned custombuild bug was that it grabbed the name from /var/lib/mysql, instead of using the mysql query: SHOW DATABASES, hence it was dumping the wrong name.

If you are actually able to create a DB with @ in the name, let me know exactly what syntax used.. as I wasn't able to do it.
Looking over the code, the only allowed characters are a-zA-Z0-9, as well as - and _. (The _ is only allowed with this)
@ was never in the list.

John
 
John, I am sorry, I was wrong. I tested now. I was not able to create a database with @. However november last year I was able to do this. At that time I was running MySQL 5.1.x. Today I am running MySQL 5.5.x

Anyway, then it seems there is no more bugs. Thank you for the fix in custombuild!
 
Last edited:
@Ditto: Can't be a 5.1.x thing. I'm using 5.1.x and I can't create a dbname with @ in it.

@John: Oke thanks for explanation and for the fix!
 
OK, So do we need to rename DBs manually or leave them as they are now with @002 in their names? Might it cause any problems let's say with upgrading MySQL from 5.1.x to 5.5.x?
 
Leave them. That's MySQL's doing. MySQL likes it best when we only access the databases via a MySQL client, through the socket.
When we do that, the special characters all show up correctly. The data back-end isn't for us to mess with.

John
 
Back
Top