Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dubis07

macrumors member
Original poster
Aug 8, 2007
33
0
I'm following Head first PHP & MySQL and proceeded through the first chapter on PHP with ease. I hit a snag on the next chapter where it started to utilize MySQL.

First, I should say that I followed these steps to install/enable Apache, PHP, and MySQL on Snow Leopard.

When I typed /usr/local/mysql/bin/mysql into Terminal, I get the "Welcome to the MySQL monitor" message that shows the version, copyright info, etc.

From here, I tried the following:
mysql> CREATE DATABASE testdatabase;

but was given the following message:
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'testdatabase'

I'm very new to it all so any help would be greatly appreciated. I also can't seem to find any folders for MySQL just by doing a Finder search, but I have a feeling the files are hidden. Would this be an issue? If I create a database, where would the files be stored?

Thank you for any help!
 
Although I really do appreciate the recommendation, I'm hoping to follow the book as closely as possible. I feel there is just a simple break in the connection somewhere, but I need some help finding it!

Any suggestions?
 
...

but was given the following message:
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'testdatabase'

Thank you for any help!

It looks as if you are connecting as an 'anonymous' user to the database. MySQL, as other databases enforces a tight role model, where different users have different permissions. You probably created a database admin during installation. Try connecting with mysql -u root

Have a look at the MySQL-Documentation, it is very readable and thorough: http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.