By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,681 Members | 1,864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,681 IT Pros & Developers. It's quick & easy.

ERROR 1045: Access denied

P: n/a
Hi programmers, Good morning ;-)

I think something is wrong,
Running windows I believe first I have to set some password,
Which creates some user,
Then I can grant the required privileges, for some databases.

However granting privileges after setting password seems to reset some
Other access,
===
C:\temp\Menagerie_01>mysql -u root -p****** mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.1.0-alpha-max-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> set password for 'elmasri'@'localhost'=password('navathe');
Query OK, 0 rows affected (0.02 sec)

mysql> set password for 'elmasri'@'%'=password('navathe');
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on company.* to 'elmasri'@'localhost' identified by
'navathe';
Query OK, 0 rows affected (0.02 sec)

mysql> grant all on company.* to 'elmasri'@'%' identified by 'navathe';
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

C:\temp\Menagerie_01>mysql -u elmasri -pnavathe company
ERROR 1045: Access denied for user: 'e******@127.0.0.1' (Using password:
YES)

===
However if I use only the grant statement,
I don't need any set password statement,

Both setting password and granting all privileges
-> ERROR 1045: Access denied

But Why ?

===
C:\temp\Menagerie_01>mysql -u root -p***** mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12 to server version: 4.1.0-alpha-max-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> grant all privileges on company.* to 'monty'@'localhost'
identified by
'python' with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

C:\temp\Menagerie_01>mysql -u monty -ppython company
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13 to server version: 4.1.0-alpha-max-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show tables
-> ;
+-------------------+
| Tables_in_company |
+-------------------+
| blabla |
+-------------------+
1 row in set (0.01 sec)

mysql> drop table blabla;
Query OK, 0 rows affected (0.00 sec)

mysql> show tables;
Empty set (0.00 sec)

mysql> create table blabla ( fname varchar(15) not null )type=innodb;
Query OK, 0 rows affected (0.00 sec)

mysql> show tables;
+-------------------+
| Tables_in_company |
+-------------------+
| blabla |
+-------------------+
1 row in set (0.00 sec)

mysql>
====

Yours Sincerely

Morten Gulbrandsen
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.