List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:March 28 2011 10:38pm
Subject:Re: phantom database
View as plain text  
In the last episode (Mar 28), brian said:
> Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (x86_64) using readline 6.1
> 
> Logged in as root, SHOW DATABASES displays a DB name that is inaccessible. 
> I haven't done anything with this DB for ~5 years.  I was recently asked
> to do some work on the project and was actually surprised that I
> (supposedly) still had it.  When I moved from fedora to ubuntu I did copy
> over some DBs although I can't remember if I'd specifically copied this
> one over.
> 
> When I noticed it was still there I tried to access it:
> 
> mysql mysql > \u db_enzyme;
> ERROR 1049 (42000): Unknown database 'db_enzyme;'

I think you want "\u db_enzyme" here, without a semicolon.  \u isn't an SQL
command so it isn't terminated by a semicolon.  That why the error message
included it in the database name.  The long version of that comand (use)
will strip a trailing semicolon automatically:

mysql> use test;
Database changed
mysql> use test 
Database changed
mysql> \u test;
ERROR 1049 (42000): Unknown database 'test;'
mysql> \u test
Database changed
mysql> 

From the docs:

MYSQL COMMANDS
       mysql sends each SQL statement that you issue to the server to be
       executed.  There is also a set of commands that mysql itself
       interprets.  For a list of these commands, type help or \h at the
       mysql> prompt:

       Each command has both a long and short form. The long form is not
       case sensitive; the short form is.  The long form can be followed by
       an optional semicolon terminator, but the short form should not.



-- 
	Dan Nelson
	dnelson@stripped
Thread
phantom databasebrian28 Mar
  • Re: phantom databaseDan Nelson29 Mar
    • Re: phantom databasebrian29 Mar