This is a discussion on unable to connect to mysql database in Wamp5 within the MySQL Database forums, part of the Database Forums category; Hi I am currently doing a web project using wamp5. Right now this is how i am connecting to the ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi
I am currently doing a web project using wamp5. Right now this is how i am connecting to the database: $con = mysql_connect("localhost", "root", ""); if (!con) { die('Could not Connect' . mysql_error()); } if (!mysql_select_db("Leave", $con)){ die (mysql_error()); } else { ........ } When the code above is activated, this is the result: ---> "Unknown database 'leave' " Could there be anything in mysql that i might have done wrong that triggers the error? or maybe there is a problem in my $con object in the 1st place? Help is much appreciated thanks |
|
|||
|
On 25 Jul, 05:30, scout3...@gmail.com wrote:
> Hi > > I am currently doing a web project using wamp5. Right now this is how > i am connecting to the database: > > $con = mysql_connect("localhost", "root", ""); > if (!con) { > die('Could not Connect' . mysql_error()); > } > if (!mysql_select_db("Leave", $con)){ > die (mysql_error());} > > else { > ....... > > } > > When the code above is activated, this is the result: ---> > "Unknown database 'leave' " > > Could there be anything in mysql that i might have done wrong that > triggers the error? or maybe there is a problem in my $con object in > the 1st place? > > Help is much appreciated > > thanks Th bit I don't understand is why the error message refers to "leave" whilst the db select call is for "Leave"? |
|
|||
|
On Jul 25, 4:13 pm, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> On 25 Jul, 05:30, scout3...@gmail.com wrote: > > > > > > > Hi > > > I am currently doing a web project using wamp5. Right now this is how > > i am connecting to the database: > > > $con = mysql_connect("localhost", "root", ""); > > if (!con) { > > die('Could not Connect' . mysql_error()); > > } > > if (!mysql_select_db("Leave", $con)){ > > die (mysql_error());} > > > else { > > ....... > > > } > > > When the code above is activated, this is the result: ---> > > "Unknown database 'leave' " > > > Could there be anything in mysql that i might have done wrong that > > triggers the error? or maybe there is a problem in my $con object in > > the 1st place? > > > Help is much appreciated > > > thanks > > Th bit I don't understand is why the error message refers to "leave" > whilst the db select call is for "Leave"?- Hide quoted text - > > - Show quoted text - i dont understand it myself. Because in my SQLiteManager my database is named "Leave", but i am not ruling out the possibility that certain configurations in e SQLite may hav sth to do with tis. |
|
|||
|
On Wed, 25 Jul 2007 10:43:29 +0200, <scout3014@gmail.com> wrote:
>> Th bit I don't understand is why the error message refers to "leave" >> whilst the db select call is for "Leave"?- Hide quoted text - >> > i dont understand it myself. Because in my SQLiteManager my database > is named "Leave", > but i am not ruling out the possibility that certain configurations in > e SQLite may hav sth to do with tis. RTFM: 9.2.2. Identifier Case Sensitivity In MySQL, databases correspond to directories within the data directory. Each table within a database corresponds to at least one file within the database directory (and possibly more, depending on the storage engine). Consequently, the case sensitivity of the underlying operating system determines the case sensitivity of database and table names. This means database and table names are not case sensitive in Windows, and case sensitive in most varieties of Unix. ............ How table and database names are stored on disk and used in MySQL is affected by the lower_case_table_names system variable, which you can set when starting mysqld. lower_case_table_names can take the values shown in the following table. On Unix, the default value of lower_case_table_names is 0. On Windows, the default value is 1. On Mac OS X, the default is 1 before MySQL 4.0.18 and 2 as of 4.0.18. Value Meaning 0 Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement. Name comparisons are case sensitive. Note that if you force this variable to 0 with --lower-case-table-names=0 on a case-insensitive filesystem and access MyISAM tablenames using different lettercases, this may lead to index corruption. 1 Table names are stored in lowercase on disk and name comparisons are not case sensitive. MySQL converts all table names to lowercase on storage and lookup. This behavior also applies to database names as of MySQL 4.0.2, and to table aliases as of 4.1.1. 2 Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement, but MySQL converts them to lowercase on lookup. Name comparisons are not case sensitive. Note: This works only on filesystems that are not case sensitive! InnoDB table names are stored in lowercase, as for lower_case_table_names=1. Setting lower_case_table_names to 2 can be done as of MySQL 4.0.18. -- Rik Wasmus |