Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Posts
    2

    Question Unanswered: Mysql 4: Invalid database name

    "show databases"
    Code:
    Databases
    usernames.May2007
    usernames.June2007
    usernames
    When I execute "use usernames.May2007" I get error:
    Code:
    Error 1102 (42000) : Invalid database name 'usernames.May2007'
    I don't now need to keep the '..2007' databases but how do I delete them?
    I get a similar error when I use drop usernames.May2007

  2. #2
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    The "." is treated as a special character in SQL to distinguish between a database and a table or a table and a field ie
    Code:
    select * from MyDatabase.MyTable
    So it's a poor idea to use the "." within the database name itself. You could try enclosing the whole database name in backticks to tell MySQL that you really do mean it's the name of a database.
    Code:
    use `usernames.May2007`;
    
    drop database `usernames.May2007`;
    Next I'd rename you're databases to something like usernames200706. Why are you storing your user names in a backup database anyway?

  3. #3
    Join Date
    Feb 2009
    Posts
    2

    Thumbs down

    The reason both for the "backups" and the *.* is that they are inherited from my predecessor
    The main database 'usernames' is now backed up regularly to Flash Drive.

    The suggestion
    drop database `usernames.May2007`;
    comes up with the "Incorrect database name" error. That's using *`* back tick?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •