unknown database

Problems with the Windows version of XAMPP, questions, comments, and anything related.

unknown database

Postby abdelelbouhy » 07. November 2010 13:18

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'
abdelelbouhy
 
Posts: 1
Joined: 07. November 2010 13:11

Re: unknown database

Postby Altrea » 07. November 2010 13:28

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)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: unknown database

Postby JonB » 07. November 2010 13:32

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
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 75 guests