0

What I did is navigated to the folder where the MySQL is installed:

cd /usr/local/mysql/bin/

then logged in:

$ ./mysql -u root -p

and tried to see databases available:

mysql-> show databases;

So I got this error:

ERROR 1046 (3D000): No database selected

Now that was confusing... And that happened only once. I tried to execute the same query like 30 seconds later (while I was still logged in), and I got the normal result - the list of available databases.

What caused the query failure at first attempt ? I have tried to repeat the steps, and I can't reproduce the issue anymore.

I am on OSX Sierra.

2 Answers 2

1

I am not 100percent sure but this is a bug in older mysql servers that require to SELECT a database prior to use any other queries althogh they are"meta" queries.

Sign up to request clarification or add additional context in comments.

2 Comments

Seems like a bug yeah.
Confirmed... Well known bug. Update your mysql or update it to a newer version.
0

That's a wired thing to happen. What happen when you use mysqlshow command like below. does it lists out all the databases?

mysqlshow -u root -p

1 Comment

It lists all the databases, yeah. As I mentioned, running a show databases; query (after successful login) didn't work only once, for the first time. Every further attempt (eg. I logout, then login) works as it should...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.