PDA

View Full Version : MySQL ERROR 1045: Access denied for user:


td6
10-21-2004, 07:46 PM
Using system 10.3.5...

I can access MySQL thru

mysql -u root -p

and I can see the 2 original databases thru

show Databases;

however, I cannot log into MySQL from the terminal just by typing mysql.
I've tried:

echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile

and it's not working. I'd like to have access to the databases other than 'test' thru my main user and not just 'root', and i'd like to be able to just type in 'mysql' to get to MySQL.

this is what I get:

ERROR 1045: Access denied for user: '****@localhost' (Using password: NO)

with **** being my user account.


Thanks

td6
10-21-2004, 08:29 PM
ok... I was able to get into MySQL from the terminal by typing

>mysql

the

>echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile

must have worked as I quit and actually rebooted... anyway, still can't make any new databases in CocoaMySQL or YourMySQL. I still get:

"access denied for user: '@localhost' to database...

how can I make my user have access to the new databases I want to create?

ezmobius
10-25-2004, 12:04 PM
Hey there-
I thing the following commands will help you do what you want.
First login to the mysql command line tool as root:
mysql -u root -p
Then once you are logged in the following command will make a use and define priveledges for oyu :
mysql> GRANT ALL ON test.* TO 'username'@'localhost';

This will grant the user 'username' all priveledges on the 'test' database. If you need more info go to the mysql online docs here
http://dev.mysql.com/doc/mysql/en/GRANT.html
Good Luck!

td6
10-25-2004, 08:46 PM
ezmobius...

that seems to work for that 'session', however, if i restart I have to:

GRANT ALL ON test.* TO 'username'@'localhost';

all over again. Is there anyway to permanently GRANT ALL for my user so I don't have to keep GRANTING ALL everytime I log-off or restart?

thanks...

OOPS. my bad... It's still there...

however... Is there a way to make 'my user' create databases without going into root each time and creating the database then 'GRANT ALL' for my user. There has to be an easier way...

stetner
10-26-2004, 08:55 AM
however... Is there a way to make 'my user' create databases without going into root each time and creating the database then 'GRANT ALL' for my user. There has to be an easier way...Sure, read
http://dev.mysql.com/doc/mysql/en/GRANT.html

especially the part about 'Global level'