Page 1 of 1

unknown database

PostPosted: 07. November 2010 13:18
by abdelelbouhy
hello guys
if you please tell me where i place my database i'm running xampp i've database called world_innodb.sql and i placed it in mysql folder so it's like that mysql/world_innodb.sql inside the database file the name is 'world' which name do i use the file name world_innobd or just world and here how i connect it
<?php
$dsn = 'mysql:host=localhost;dbname=world_innodb;';
$user = 'root';
$password = '';
try{
$db = new PDO($dsn,$user,$password);
}catch(PDOException $e){
echo 'connection faild: ' . $e->getMessage();
}

?>
and that what i got
connection faild: SQLSTATE[42000] [1049] Unknown database 'world_innodb'

Re: unknown database

PostPosted: 07. November 2010 13:28
by Altrea
hello,

abdelelbouhy wrote:i've database called world_innodb.sql

No, that is no database. That is a database export file!

abdelelbouhy wrote:i placed it in mysql folder so it's like that mysql/world_innodb.sql

That wouldn't work.

You have to create a Database in mysql first (e.g. use phpmyadmin for this)
After that import your sql file into that database (you can do this with phpmyadmin too)

abdelelbouhy wrote:which name do i use

If you have created a database and imported your database data, you use the name of the database to connect your database (simple as it is)

Re: unknown database

PostPosted: 07. November 2010 13:32
by JonB
what exactly do you mean by this:

i placed it in mysql folder


I'm unaware of a concept of 'placing' a database in MySQL. I am aware of 'creating' a database with SQL statements either programmatically (phpMyAdmin included) or by using the mysql.exe CLI. The MySQL database manager and its configuration files determine where a database instance's datafiles are located.

How did you create this database, and can you see it in the database table on the left when you start phpMyAdmin?
:?:

Good Luck