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

ERROR 1045 (28000) Access denied for user 'root'@'localhost'. Symfony. Bitnami WAMP

100+
P: 103
I sit already 2h browsing internet and i am not able to find a solution. Could you please help me.

Bitnami WAMP, Symfony

1) I am not able to login to MYSQL through console
using command: mysql -u root -p
using command: mysql -h localhost -u root -p
using command: mysql -h localhost -u root -p -P 3006
using command: mysql -h 127.0.0.1 -u root -p
using command: mysql -h 127.0.0.1 -u root -p -P 3006
i am getting the same error in all cases: ERROR 1045 (28000) Access denied for user 'root'@'localhost' (using password: NO)

2) I am not able to login to PhpMyAdmin, using user "root" and empty field for password.

3) I am not able to generate entity from console in Symfony application. I am getting error:[PDOException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (password: NO)


config.inc.php
in folder
C:\Bitnami\wampstack-5.4.36-0\apps\phpmyadmin\htdocs\config.inc.php
contains the following lines:
Expand|Select|Wrap|Line Numbers
  1. $cfg['Servers'][$i]['host'] = 'localhost';
  2. $cfg['Servers'][$i]['user'] = 'root';
  3. $cfg['Servers'][$i]['password'] = '';
  4. $cfg['Servers'][$i]['port'] = '3306'; 
I also tried 127.0.0.1 instead of localhost.

parameters.yml
in folder
C:\Bitnami\wampstack-5.4.36-0\sym_prog\myproject\app\config
contains the following lines:
Expand|Select|Wrap|Line Numbers
  1. parameters:
  2.     database_driver: pdo_mysql
  3.     database_host: 127.0.0.1
  4.     database_port: null
  5.     database_name: symfony
  6.     database_user: root
  7.     database_password: null
  8.     mailer_transport: smtp
  9.     mailer_host: 127.0.0.1
  10.     mailer_user: null
  11.     mailer_password: null
  12.     locale: en
  13.     secret: 50cbd9b37723fsdfgd9202880589f27baa6df5b3dd
i also tried "localhost" instead of 127.0.0.1.

How to make user 'root'@'localhost' to be accepted?
Mar 6 '15 #1
Share this Question
Share on Google+
10 Replies


100+
P: 103
When i try to use command mysql in console, i am geting error that 'ODBC'@'localhost' can not connect.


c:\Bitnami\wampstack-5.4.36-0>mysql
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)
Mar 7 '15 #2

Expert 100+
P: 1,035
I think your root password is not matching with what you provide during your attempts...

Try resetting the password for 'root'

see: http://dev.mysql.com/doc/refman/5.0/...rmissions.html
Mar 7 '15 #3

100+
P: 103
C:\Bitnami\wampstack-5.4.36-0\apps\phpmyadmin\htdocs\config.inc.php

$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['nopassword'] = true;
$cfg['Servers'][$i]['AllowNoPassword'] = true;

It means that i do not need password to login.
Mar 7 '15 #4

Expert 100+
P: 1,035
No, it meand that phpmyadmin is configured not to as for as password.......

But how it MySQL configured????
Mar 7 '15 #5

100+
P: 103
I use command: mysql --help --verbose
It output the following directories and filenames:
Expand|Select|Wrap|Line Numbers
  1. Default options are read from the following files in the given order:
  2. C:\Windows\my.ini 
  3. C:\Windows\my.cnf 
  4. C:\my.ini 
  5. C:\my.cnf 
  6. c:\bitnami\wampstack-5.4.36-0\mysql\my.ini 
  7. c:\bitnami\wampstack-5.4.36-0\mysql\my.cnf
I could not find:
C:\my.ini
C:\my.cnf
C:\Windows\my.ini
C:\Windows\my.cnf
c:\bitnami\wampstack-5.4.36-0\mysql\my.cnf
I found only
c:\bitnami\wampstack-5.4.36-0\mysql\my.ini
which does not contain password option. The contents without most of comments:
Expand|Select|Wrap|Line Numbers
  1. [mysqldump]
  2. max_allowed_packet=16M
  3.  
  4. [isamchk]
  5. key_buffer_size=20M
  6. sort_buffer_size=20M
  7. read_buffer=2M
  8. write_buffer=2M
  9.  
  10. [myisamchk]
  11. key_buffer_size=20M
  12. sort_buffer_size=20M
  13. read_buffer=2M
  14. write_buffer=2M
  15.  
  16. [mysqlhotcopy]
  17.  
  18. [mysqladmin]
  19. user=root
  20. port=3306
  21. # set basedir to your installation path
  22. basedir=C:/Bitnami/WAMPST~1.36-/mysql
  23. # set datadir to the location of your data directory
  24. datadir=C:/Bitnami/WAMPST~1.36-/mysql\data
  25. port=3306
  26. #skip-locking
  27. key_buffer_size=16M
  28. max_allowed_packet=16M
  29. table_cache=64
  30. sort_buffer_size=512K
  31. net_buffer_length=8K
  32. read_buffer_size=256K
  33. read_rnd_buffer_size=512K
  34. myisam_sort_buffer_size=8M
  35. bind-address=127.0.0.1
  36.  
  37.  
Finally i have added line to
c:\bitnami\wampstack-5.4.36-0\mysql\my.ini
I have tried several combinations, restarting MySQL server each time i make change:
password="some"
password='some'
password=some
password=none
password=""
password=''

I check if this works by command
mysql -u root -p
But i am still getting error "ERROR 1045 (28000): Access denied for user 'root'@'localhost'".

I also tried command:
mysql -u root -p "some"
(with "", '' and without quotes), but it outputs help.
According
http://www.cyberciti.biz/faq/mysql-c...root-password/
This command works only for the first time. If password already exists somewhere, this command is not working.

According,
http://www.cyberciti.biz/tips/recove...-password.html
Expand|Select|Wrap|Line Numbers
  1. (1) Stop the server: /etc/init.d/mysql stop 
  2. (2) Start the mysql daemon: # mysqld_safe –skip-grant-tables
  3. (3)* While its running, open another terminal and login to mysql
  4. # mysql -u root (hit enter)
  5. (4) Now you are logged in.
  6. mysql>use mysql;
  7. mysql>update user set password=PASSWORD(“YOUR_NEW_PASS”) where User=’root';
  8. you should see the output: Query ok etc.
  9. mysql>flush privileges;
  10. mysql>quit
  11. (5) stop the server: /etc/init.d/mysql stop
  12. (6) *Confirm that no mysql processes are still running (in my case they were and made the server fail to start). To check this: run this
  13. ps ax | grep mysql
  14. Now kill the process IDs of any mysql still running in the background using kill PID
  15. e.g. kill 4425. Do not use kill -9 as this may crash the database entirely!!
  16. Confirm no mysql process is still running: ps ax | grep mysql
  17. (7) Then start the server: /etc/init.d/mysql start
  18. (8) login with your new password: mysql -u root -p
But in my case, seems mysqld is not working.
I have found
C:\Bitnami\wampstack-5.4.36-0\mysql\bin\mysqld.exe
Using command: mysqld --verbose --help
outputs range of commands "–skip-grant-tables" including, but there is a notice FALSE on the same line.
I stop mysql server from WINAMP options window, than i run: mysqld –skip-grant-tables
than i open another termnal and try to login using: mysql -u root
I am getting "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)"


How to configure(set) password for root in mysql?
Should i create *.cnf file?

Actually the main problem is that i can not create tables in Symfony. Most probably symfony use "C:\Bitnami\wampstack-5.4.36-0\sym_prog\myproject\app\config\parameters.yml" parameters and overwrites mysql settings? But it can not overwrite because it tries to overwrite the wrong file, which does not exists?
Mar 8 '15 #6

Expert 100+
P: 1,035
Because you configured phpmyadmin to NOT use a password for root,
You should make sure you can use MySQL with :
C:\> MySQL -u root

If above is failing, than try, (and specify the correct paasword):
C:\> MySQL -u root -p
If you need this last line, than your setup of MySQL is not in line with the setup of phpmyadmin.
Mar 8 '15 #7

100+
P: 103
I do not agree that settings:
$cfg['Servers'][$i]['nopassword'] = true;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
affects how root logins.

The question is how to reset root password if it is forgotten or how to retrieve it?

Finally, i have reinstalled Bitnami WAMP, i was asked to create root password on the first step and now everything works using this password.

But if somebody could tell how to reset MYSQL root password or how to retrieve it if i forget, could you please write.

mysql Ver 14.14 Distrib 5.5.42, for Win32 (x86)
installed with Bitnami WAMP stack 5.4.38-0
Mar 8 '15 #8

100+
P: 103
All discussion above complains about several different things: that i can not login to mysql from command line as root, that i can not login to PhPMyAdming, that i can not generate tables with Symfony.

Summarizing, the question is "how to reset MYSQL root password or how to retrieve it if i forget"?

mysql Ver 14.14 Distrib 5.5.42, for Win32 (x86)
installed with Bitnami WAMP stack 5.4.38-0
Mar 8 '15 #9

Expert 100+
P: 1,035
"Summarizing, the question is "how to reset MYSQL root password or how to retrieve it if i forget"?"

see my first reply, the link is:
http://dev.mysql.com/doc/refman/5.0/...rmissions.html
Mar 8 '15 #10

100+
P: 103
THANKS, NOW IT WORKS!!!
I did not read your first reply carefully, i am sorry!

Just several notices.
After BITNAMI WAMP INSTALLATION
1) MySQL server is not running as a service ( "From the Start menu, select Control Panel, then Administrative Tools, then Services").
2) MySQL service is not listen in Task Manager Services (Ctl+Al+Del on Windows)
3) It is possible to stop the service only though WAMPStack Manager Tool.
4) Trying the given command "mysqld-nt" outputs error: "c:\>mysqld-nt --init-file=C:\\mysql-init.txt
'mysqld-nt' is not recognized as an internal or external command, operable program or batch file."

5)Trying the modified command "mysqld -nt" outputs warning but works, i.e changes root password: "c:\>mysqld -nt --init-file=C:\\mysql-init.txt
150308 15:05:44 [Warning] option 'new': boolean value 't' wasn't recognized. Set to OFF."""
Mar 8 '15 #11

Post your reply

Sign in to post your reply or Sign up for a free account.