Access Denied to MYSql

Hello All,

I am trying to set up my computer so I can test a website using PHP and MYSql. Setting up mysql has been a quite a chore as I have not seen any one set of great instructions on doing so. However, I think I have it up and running except for one problem. I have been following a tutorial on using MYSql and when they want me to create a data base, i get an error message following this command "create database petstore":

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'petstore'

This is from the terminal program. I have also tried using CocoaMysql and when that software tries to create a database or even change the "test" database already installed, I also get that same error message.

Now, I am able to start mysql, and I can even look at the "test" database already installed. I have set no passwords for mysql, and I even went through the "mysql secureinstallation" procedure which among other things, asks about resetting the password, which at this time I chose to leave blank. After scouring the internet, I am not able to find any reason for my problem. Does anyone know?

thanks,

2.66 GHz Intel, Mac OS X (10.4.8)

Posted on May 15, 2008 3:15 PM

Reply
5 replies

May 15, 2008 10:11 PM in response to Clea Rees

I am running mysql version 5.1

I installed the automatic startup file which starts it automatically. I also can use the command:

sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

... to start it up. As I said, the error comes if I just try to create a new database like so:

create database petstore;

... but I also get the same error if I try to create a database with CocoasMysql. However, I have been able to create tables in the "test" database which is already installed on the system from the terminal. CocaoMysql can not add tables to it however ... I get that same annoying error.

any ideas?

thanks!

May 15, 2008 10:43 PM in response to bshonk

bshonk wrote:
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'petstore'


Hmm. This looks like you're logging in to MySQL with an empty user name. Usually, you'd see a user name before the "@". Try logging in as the root user. From the Terminal, it's like this:

mysql -u root


Since you don't have a root password (for MySQL, anyway), you should just be able to get in. If that doesn't work, you may have to reset the passwords, in particular the root one. There are a number of tutorials online for doing that. I've never done it myself, but I could probably help you through it.

charlie

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Access Denied to MYSql

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.