1

I'm going to preface this with saying I'm a complete newbie at this database stuff before the rolling of the eyes happens, so please be patient with me.

I have an sql dump that I am trying to import and access (running Linux mysql). I created the database...

mysql> CREATE DATABASE db_name

And then tried to import the sql file into the database...

mysql -uroot -p db_name < db_import.sql

At this point, I don't see any errors and everything seems fine, so I assume the import worked. However, I have no idea how to access the imported data because SELECT * FROM db_name; returns ERROR 1146 (42S02): Table 'db_name.db_name' doesn't exist. Similarly for FROM db_import;.

I understand that it's looking for a table db_name within db_name, but where would the imported data go? How can I access it? Did I do the import wrong?

  • What does db_import.sql contains.Is it a mysqldump file? – Abdul Manaf Jan 3 '14 at 11:06
  • @AbdulManaf - Yes, it is. – Andrew Jan 3 '14 at 11:13
1

Connect using mysql cli:

mysql -u <username> -p<pass> db_name

The following command will show you the imported tables:

show tables;

Then, access the data:

select * from <table_name>;

where *table_name* is one of the tables in the show tables' output.

  • Wow, all I was missing was show tables; to figure it out -- thanks! Sorry for the ridiculous question. – Andrew Jan 3 '14 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.