DB problem on MAMP

Hi there,

I’m just in the process of switching my web development environment from PC to Mac. I was using WAMP before and now am setting up MAMP. My project uses PHP and MySQL to connect to a database and show content.

MySQL is set up with my root password, and I can log in using Terminal -> mysql - u root -p and I can connect to my DB with “use Geo;” and I can perform any SQL I want - ie “SELECT * from users”.

However when I do the exact same SQL from my webpage I get the error : Table ‘Geo.users’ doesn’t exist"

I haven’t changed any of my code, all I’ve done is moved from Windows 7 and WAMP to Mac OS X and MAMP. MAMP is set up to use the default ports for Apache and MySQL (80 and 3306 instead of 8888 and 8889).

Anyone have any ideas? I’m totally stuck on this. Thanks

My PHP code that accesses the DB is this:


$link = mysqli_connect('localhost', 'root', 'xxxxxx');
if (!$link) die('Unable to connect to the database server.');

if (!mysqli_set_charset($link, 'utf8')) die('Unable to set database connection encoding.');

if (!mysqli_select_db($link, 'Geo')) die("Unable to locate the Geo database.");

//perform query on DB
    $sql = "SELECT * from users WHERE username = '1188' AND password = 'xxxxx' ";
    $result = mysqli_query($link, $sql);
    if (!$result) die('Error fetching data for SQL :'.$sql.' Error: '. mysqli_error($link));


Have you verified that the table exists and that it’s spelt as you expect (taking the case of the table name into account)?

It looks like my Database is “Geo” capital G, and the tables are all lower case.

mysql> show tables;
| Tables_in_geo |
| comments |
| images |
| logs |
| mdu |
| users |
5 rows in set (0.00 sec)

mysql> show databases;
| Database |
| information_schema |
| Geo |
| mysql |
| performance_schema |
4 rows in set (0.00 sec)


UPDATE : I was able to fix this by changing the database name to lower case. It’s weird, because I have it capitalized in my database, but it needs to be lower case when using it.

What’s even weirder is that this wasn’t an issue under WAMP. I didn’t change a single line of code, I only changed my server to a Mac and installed MAMP. I restored my db using the mysql dump to .sql file, so everything was identical. Very strange. Anyone have any why this could be?


it is because of the underlying file system