2

I'm trying connect me to database MySQL server but the console show me ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) I don't know why. Please help me. In my file my.cnf I have something like this,

[mysqld] datadir=/var/lib/mysql socket=/tmp/mysql.sock user=mysql # Default to using old password format for compatibility with mysql 3.x # clients (those using the mysqlclient10 compatibility package). old_passwords=1 # To allow mysqld to connect to a MySQL Cluster management daemon, uncomment # these lines and adjust the connectstring as needed. #ndbcluster #ndb-connectstring="nodeid=4;host=localhost:3306" [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [ndbd] # If you are running a MySQL Cluster storage daemon (ndbd) on this machine, # adjust its connection to the management daemon here. # Note: ndbd init script requires this to include nodeid! connect-string="nodeid=2;host=localhost:3306" [ndb_mgm] # connection string for MySQL Cluster management tool connect-string="host=localhost:3306" [client] socket=/tmp/mysql.sock 

enter image description here

Thanks.

8
  • Can you show how you connect via console? (ommiting passwords if supplied on commandline) Commented Aug 5, 2012 at 18:42
  • Sure, Hectors-MacBook-Pro:~ hlozano$ mysql -uroot -p Commented Aug 5, 2012 at 18:43
  • Did you set a password during installation? :) Just hitting Enter on password prompt doesn't help? And you're sure you're entering proper password? (Sorry for the obvious questions, just want to make sure) :) Commented Aug 5, 2012 at 18:44
  • Oh of course, I reinstall the MySQL server because not up the databases. When I restart my MAC did not entry to database. Commented Aug 5, 2012 at 18:47
  • 1
    If you really don't remember the pass anymore, you can add skip_grant_tables to [mysqld] section of your my.cnf, restart server it will let you in without a password, then you can change password by updating mysql.user table and restart mysql removing the skip_grant_tables option. Commented Aug 5, 2012 at 18:50

2 Answers 2

3

If you really don't remember the pass anymore, you can add skip_grant_tables to [mysqld] section of your my.cnf, restart server, it will let you in without a password, then you can change password by updating mysql.user table and restart mysql removing the skip_grant_tables option.

Sign up to request clarification or add additional context in comments.

Comments

0

The -p flag denotes the requirement for a password. There should be a second prompt after typing what you typed requesting the password. For example:

$ mysql -u root -p $ Enter password: 

Then you type the password.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.