Question Locked

MySQL question

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Somedays I really hate computers. :(

Ok here's what I got. I've been troubleshooting a MySQL database connection problem for a couple days now. I think I figured out it was I permission problem. I tried to grant access on the database and it tells me access denied. I am logged in as root. The error message looks like this.

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

It looks like my credentials aren't being passed when I excute the command. I envoke mysql from the command line using the following.

>mysql -uroot

Any ideas?

3 replies

by Former member

grant all on (database_name).* to (user)@(hostname) identified by '(password)';

this is the command you need. The parenetheses are not needed, I use them to indicate where you have to put in your specific values. If you are just running one machine you can use localhost for you hostname.

further info on the GRANT command. RTFM.

If you run the command as `root', you should use the `--user'
option as shown. The value of the option should be the name of the
login account that you created in the first step to use for
running the server. If you run the command while logged in as that
user, you can omit the `--user' option.

do:

mysql -u root

see if you see somthing like:

----------------+
| current_user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

do:
mysql> select user, password, host from mysql.user;

+------+----------+------------+
| user | password | host |
+------+----------+------------+
| root | | localhost |
| root | | redacted |
| | | redacted |
| | | localhost |
+------+----------+------------+

CREATE DATABASE command should work fine.

http://dev.mysql.com/doc/refman/5.0/en/index.html
http://bytes.com/forum/thread517500.html

Please post back if you have any more problems or questions.

by jiminpa

The problem isn't that I don't know the commands, the problem is when I am logger in as root or when I envoke mysql by using the --user option, it never logs me in as the root user. My user name is blank and therefore sue to lack of perrmissions I cannot execute any commands.

This discussion is closed to new replies.