Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

share|improve this question
    
What does db_import.sql contains.Is it a mysqldump file? –  Abdul Manaf Jan 3 at 11:06
    
@AbdulManaf - Yes, it is. –  Andrew Jan 3 at 11:13

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Wow, all I was missing was show tables; to figure it out -- thanks! Sorry for the ridiculous question. –  Andrew Jan 3 at 11:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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