error 1146 trying to connect into mysql

i have a database i backed from another server using mysqldump

the database is called pbx

so, i created pbx database on the new server, then restored the backup file into pbx

this is where i gets confusing, the username an password are also pbx (not my idea).

so i  created the user 'pbx' then used

grant all privileges on pbx.* to pbx@'%' identified by 'pbx';

Open in new window


this i thought granted user rights for a specific user on a specific db.

then when i try

"Select * from pbx;"

ERROR 1146 (42S02): Table 'pbx.pbx' doesn't exist

Open in new window


any ideas?!

i just want to see if the backup is complete etc....

thanks
mudcow007Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy PooleCommented:
Your query is trying to select records from a table called pbx, do you also have a table named pbx in your pbx database?
0
mudcow007Author Commented:
ah gotcha, all im trying to display is the whole contents of database.

did i use the wrong command?
0
Randy PooleCommented:
there really isn't a simple transact sql command for that. Why don't you open the database in MySQL Administrator program or QueryBrowser?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Randy PooleCommented:
or maybe there is :P
mysqlshow pbx

Open in new window


You can read up on this command at:
http://dev.mysql.com/doc/refman/5.0/en/mysqlshow.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
Here is a teaching example of a PHP script that does it.  Uses the MySQLi extension.

<?php // demo/mysqli_list_dbs.php
ini_set('display_errors', TRUE);
error_reporting(E_ALL);
echo '<pre>';


// THIS SCRIPT DEMONSTRATES HOW TO FIND DATABASES AND TABLES USING MySQLi


// THE ABSOLUTE MINIMUM YOU MUST UNDERSTAND TO USE PHP AND MYSQLI
// MAN PAGE: http://php.net/manual/en/mysqli.overview.php
// MAN PAGE: http://php.net/manual/en/class.mysqli.php
// MAN PAGE: http://php.net/manual/en/class.mysqli-stmt.php
// MAN PAGE: http://php.net/manual/en/class.mysqli-result.php
// MAN PAGE: http://php.net/manual/en/class.mysqli-warning.php
// MAN PAGE: http://php.net/manual/en/class.mysqli-sql-exception.php <-- DID NOT WORK PHP 5.3+, MySQL 5.1+
// MAN PAGE: http://php.net/manual/en/mysqli.construct.php
// MAN PAGE: http://php.net/manual/en/mysqli.real-escape-string.php
// MAN PAGE: http://php.net/manual/en/mysqli.query.php
// MAN PAGE: http://php.net/manual/en/mysqli.errno.php
// MAN PAGE: http://php.net/manual/en/mysqli.error.php
// MAN PAGE: http://php.net/manual/en/mysqli.insert-id.php
// MAN PAGE: http://php.net/manual/en/mysqli-result.num-rows.php
// MAN PAGE: http://php.net/manual/en/mysqli-result.fetch-array.php
// MAN PAGE: http://php.net/manual/en/mysqli-result.fetch-object.php


// DATABASE CONNECTION AND SELECTION VARIABLES - GET THESE FROM YOUR HOSTING COMPANY
$db_host = "localhost"; // PROBABLY THIS IS OK
$db_name = "??";
$db_user = "??";
$db_word = "??";

// OPEN A CONNECTION TO THE DATA BASE SERVER AND SELECT THE DB
$mysqli = new mysqli($db_host, $db_user, $db_word, $db_name);

// DID THE CONNECT/SELECT WORK OR FAIL?
if ($mysqli->connect_errno)
{
    $err
    = "CONNECT FAIL: "
    . $mysqli->connect_errno
    . ' '
    . $mysqli->connect_error
    ;
    trigger_error($err, E_USER_ERROR);
}

// ACTIVATE THIS TO SHOW WHAT THE DB CONNECTION OBJECT LOOKS LIKE
// var_dump($mysqli);


// GET A LIST OF THE DATA BASES ON THIS CONNECTION
$sql = 'SHOW DATABASES';
if (!$res = $mysqli->query($sql))
{
    $err
    = 'QUERY FAILURE:'
    . ' ERRNO: '
    . $mysqli->errno
    . ' ERROR: '
    . $mysqli->error
    . ' QUERY: '
    . $sql
    ;
    trigger_error($err, E_USER_ERROR);
}

while ($row = $res->fetch_object())
{
    $db_names[] = $row->Database ;
}
echo "LIST OF DB NAMES: ";
print_r($db_names);


// SELECT ONE MYSQL DATA BASE
$db_name     = $db_names[0];
if (!$db_sel = $mysqli->select_db($db_name))
{
    $err
    = 'QUERY FAILURE:'
    . ' ERRNO: '
    . $mysqli->errno
    . ' ERROR: '
    . $mysqli->error
    . ' QUERY: '
    . $sql
    ;
    trigger_error($err, E_USER_ERROR);
}

// SHOW THE TABLES ON THIS DATA BASE
$sql = "SHOW TABLES FROM $db_name";
if (!$res = $mysqli->query($sql))
{
    $err
    = 'QUERY FAILURE:'
    . ' ERRNO: '
    . $mysqli->errno
    . ' ERROR: '
    . $mysqli->error
    . ' QUERY: '
    . $sql
    ;
    trigger_error($err, E_USER_ERROR);
}

// SET THE NAME OF THE PROPERTY WITH THE DB NAME INCLUDED
$prop = "Tables_in_$db_name";
while ($row = $res->fetch_object())
{
    $db_tables[] = $row->$prop;
}

echo "LIST OF TABLES IN $db_name: ";
print_r($db_tables);

Open in new window

0
mudcow007Author Commented:
awesome thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.