Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > ERROR 1044: Access denied for user: '@localhost' to database 'mydb'

ERROR 1044: Access denied for user: '@localhost' to database 'mydb'
Thread Tools
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Feb 25, 2006, 09:26 PM
 
When I try to create a new sql db using:

mysql> create database mydb;

I get this error:

ERROR 1044: Access denied for user: '@localhost' to database 'mydb'

Any ideas?
     
Professional Poster
Join Date: Jan 2001
Location: Salt Lake City, UT USA
Status: Offline
Reply With Quote
Feb 25, 2006, 09:31 PM
 
sounds like your user doesn't have rights to create new DBs. Are you logged as root? Have you granted permissions to the user to create DBs?

What's your setup?
2008 iMac 3.06 Ghz, 2GB Memory, GeForce 8800, 500GB HD, SuperDrive
8gb iPhone on Tmobile
     
Professional Poster
Join Date: Jan 2001
Location: Salt Lake City, UT USA
Status: Offline
Reply With Quote
Feb 25, 2006, 09:35 PM
 
Oh... I don't know what I'm thinking here. What user are you logged in as? It should be reporting some user, which means you're probably logged in as anonymous, which would have no access.
2008 iMac 3.06 Ghz, 2GB Memory, GeForce 8800, 500GB HD, SuperDrive
8gb iPhone on Tmobile
     
Professional Poster
Join Date: Jan 2001
Location: Salt Lake City, UT USA
Status: Offline
Reply With Quote
Feb 25, 2006, 09:41 PM
 
Yeah, I'm pretty sure it's anonymous. You need to login as a user:

from the terminal, you can use:

mysql -u username -p

and then it will prompt you for a password. If you don't have any users setup, login as root (which in the default installation doesn't have a password set.) and setup a new user.

as root:

use mysql

insert into mysql (Host,User,Password) values ('host','user',PASSWORD('password'));


Does that make sense? The italics should be your actual values, everything else is verbatim. There are lots of variables, but that will give you a basic user to use.
2008 iMac 3.06 Ghz, 2GB Memory, GeForce 8800, 500GB HD, SuperDrive
8gb iPhone on Tmobile
     
skyman  (op)
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Feb 25, 2006, 09:45 PM
 
Originally Posted by SirCastor
Oh... I don't know what I'm thinking here. What user are you logged in as? It should be reporting some user, which means you're probably logged in as anonymous, which would have no access.
I open terminal then I type "login"

I enter my admin user name and my password.

I then type /usr/local/mysql/bin/mysql

Then I get the mysql prompt.

mysql>

I then type: create database mydb;

Then I get the error.
     
skyman  (op)
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Feb 25, 2006, 09:49 PM
 
Originally Posted by SirCastor
Yeah, I'm pretty sure it's anonymous. You need to login as a user:

from the terminal, you can use:

mysql -u username -p

and then it will prompt you for a password. If you don't have any users setup, login as root (which in the default installation doesn't have a password set.) and setup a new user.

as root:

use mysql

insert into mysql (Host,User,Password) values ('host','user',PASSWORD('password'));


Does that make sense? The italics should be your actual values, everything else is verbatim. There are lots of variables, but that will give you a basic user to use.

When I enter mysql -u username -p

I get this error:

tcsh: mysql: Command not found.
     
skyman  (op)
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Feb 25, 2006, 09:52 PM
 
Originally Posted by SirCastor
Yeah, I'm pretty sure it's anonymous. You need to login as a user:

from the terminal, you can use:

mysql -u username -p

and then it will prompt you for a password. If you don't have any users setup, login as root (which in the default installation doesn't have a password set.) and setup a new user.

as root:

use mysql

insert into mysql (Host,User,Password) values ('host','user',PASSWORD('password'));


Does that make sense? The italics should be your actual values, everything else is verbatim. There are lots of variables, but that will give you a basic user to use.
Stupid question, but how do I login as root?
     
Professional Poster
Join Date: Jan 2001
Location: Salt Lake City, UT USA
Status: Offline
Reply With Quote
Feb 25, 2006, 10:00 PM
 
not a stupid question. You don't have a command setup to access MySQL from anywhere, you just need to combine a couple things, or set a command, which is easy.

first, here's how you should login to your mysql
Code:
/usr/local/mysql/bin/mysql -u root -p
that'll prompt you for a password. root probably doesn't have one set yet.


These type on the Command Line should set up a command so you can type 'mysql' without having to go through all those directories to run the client.
It'll also do mysqladmin
Code:
alias mysql /usr/local/mysql/bin/mysql alias mysqladmin /usr/local/mysql/bin/mysqladmin
2008 iMac 3.06 Ghz, 2GB Memory, GeForce 8800, 500GB HD, SuperDrive
8gb iPhone on Tmobile
     
skyman  (op)
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Feb 25, 2006, 10:06 PM
 
Originally Posted by SirCastor
not a stupid question. You don't have a command setup to access MySQL from anywhere, you just need to combine a couple things, or set a command, which is easy.

first, here's how you should login to your mysql
Code:
/usr/local/mysql/bin/mysql -u root -p
that'll prompt you for a password. root probably doesn't have one set yet.
Sweet! That worked. Thanks!
     
Professional Poster
Join Date: Jan 2001
Location: Salt Lake City, UT USA
Status: Offline
Reply With Quote
Feb 25, 2006, 10:12 PM
 
Cool

Don't forget to set a password for root, there are actually two of them.
in MySQL, type in this to see the users and if they have anything set.

Code:
use mysql select User, Host, Password from user;
2008 iMac 3.06 Ghz, 2GB Memory, GeForce 8800, 500GB HD, SuperDrive
8gb iPhone on Tmobile
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:31 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2