MySQL said: #1045 Access denied

Problems with the Windows version of XAMPP, questions, comments, and anything related.

MySQL said: #1045 Access denied

Postby 3iglobal » 06. March 2012 13:30

Hello.
I am facing the same problem and I tried to employ the method above.
The error message I am getting is
Code: Select all
Connection for controluser as defined in your configuration failed.

Code: Select all
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

After I run this code
Code: Select all
mysqld --init-file="C:\xampp\mysql\undoroot.sql"

the cursor just keeps blinking. There is no other activity and the mysql server does not start.
How long does it take for the undoroot.sql to run?
Also is there any other method to solve this problem.
Help will be appreciated.
Thanks and Regards
3iglobal
 
Posts: 7
Joined: 06. March 2012 13:25
Operating System: Windows 7 Ultimate 64-bit

Re: MySQL said: #1045 - Access denied for user 'root'@'loc

Postby hackattack142 » 07. March 2012 00:00

You do not appear to have the same issue as the OP. The control user is typically a different user than root (pma is what i typically see).

Are you having problems connecting to a running server or getting the server to start?

Did you change those entries in the config.inc.php file?

Did you delete or set any passwords for users?
XAMPP Control Panel Developer
Latest CP: viewtopic.php?f=16&t=48932
hackattack142
 
Posts: 703
Joined: 20. May 2011 23:29
Operating System: Windows 7 Ultimate SP1 64-Bit

Re: MySQL said: #1045 - Access denied for user 'root'@'loc

Postby 3iglobal » 07. March 2012 07:06

hackattack142 wrote:You do not appear to have the same issue as the OP. The control user is typically a different user than root (pma is what i typically see).

Are you having problems connecting to a running server or getting the server to start?

Did you change those entries in the config.inc.php file?

Did you delete or set any passwords for users?


The server is running. I am trying to create new databases for new websites. I am a web developer and do a lot of work offline.
The problem just cropped up without any changes being made. I did not edit any file. I did not change, set or delete any password for the admin user. About 2 weeks ago I was trying out a script for realty listings. I had to create a new user and assign a password as the script wouldn't install without one.
I tried this method
http://goodsarves.blogspot.in/2010/07/reset-mysql-root-password-in-lamp-xampp.html
Code: Select all
1.. Stop mysqld
2. start /opt/lampp/sbin/mysqld --skip-grant-tables --user=nobody (I did the windows equivalent by navigating to the xampp\mysql\bin directory)
3. open new terminal and type : mysql -u root (I used Xampp shell for this)
4. excute following commands in order :
shell> mysql
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
mysql> FLUSH TABLES;
mysql> exit


After doing this I could open phpmyadmin, but I did not have create privileges. I could view all the databases but could not create a new one. Also when I tried changing the password to "No Password" I saw another error code #1293 ( Not sure as i haven't been able to replicate it again) The wordings were to the effect that I was logged in without privileges.

Still no able to log into phpmyadmin.
Thanks and Regards
3iglobal
 
Posts: 7
Joined: 06. March 2012 13:25
Operating System: Windows 7 Ultimate 64-bit

Re: MySQL said: #1045 - Access denied for user 'root'@'loc

Postby Sharley » 07. March 2012 07:16

I did not change, set or delete any password for the admin user.
You should login using the super user root as your username and a blank password box, as no password is required if you have not set one in the Security section of the XAMPP Welcome (Admin) page.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: MySQL said: #1045 - Access denied for user 'root'@'loc

Postby 3iglobal » 07. March 2012 07:38

Sharley wrote:
I did not change, set or delete any password for the admin user.
You should login using the super user root as your username and a blank password box, as no password is required if you have not set one in the Security section of the XAMPP Welcome (Admin) page.


Thanks
I just open the phpmyadmin through my browser. My MySql skills on command line are rudimentary. Could you please elaborate on where to login with the root credentials?

I am asking some very basic questions but I am a little apprehensive as I haven't done this before. I do not want to lose any data.

Thanks and regards
3iglobal
 
Posts: 7
Joined: 06. March 2012 13:25
Operating System: Windows 7 Ultimate 64-bit

Re: MySQL said: #1045 - Access denied for user 'root'@'loc

Postby Sharley » 07. March 2012 07:49

In your browser type
http://localhost/phpmyadmin
You should be presented with a login screen where you enter the username root and then leave the password box blank.

If you don't see a login screen then open the file \xampp\phpmyadmin\config_inc.php in your text editor and look for this line and change it to look like this if required
Code: Select all
$cfg['Servers'][$i]['auth_type'] = 'cookie';
Do not change or add anything else.

Save the file and restart Apache and MySQL then follow the above login procedure.
You will need to accept cookies when prompted.

Good luck
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: MySQL said: #1045 - Access denied for user 'root'@'loc

Postby 3iglobal » 07. March 2012 08:44

No luck.
I get the following error on top of the login box after entering user id "root"
Code: Select all
#1045 - Access denied for user 'root'@'server' (using password: NO)

and this error below the login box
Code: Select all
Connection for controluser as defined in your configuration failed.
3iglobal
 
Posts: 7
Joined: 06. March 2012 13:25
Operating System: Windows 7 Ultimate 64-bit

Re: MySQL said: #1045 - Access denied for user 'root'@'loc

Postby 3iglobal » 07. March 2012 08:50

I am sorry to hijack this thread.Can the moderator fork this thread.
3iglobal
 
Posts: 7
Joined: 06. March 2012 13:25
Operating System: Windows 7 Ultimate 64-bit

Re: MySQL said: #1045 - Access denied for user 'root'@'loc

Postby Sharley » 07. March 2012 09:20

3iglobal wrote:I am sorry to hijack this thread.Can the moderator fork this thread.
Done.
Split from original thread:
viewtopic.php?f=16&t=49609


Access denied for user 'root'@'server'
We have now revealed an issue that localhost is not being recognised.

Where did you install XAMPP in your Windows 7 installation?

Did you install it to C:\xampp or some other location?

Drag C:\Windows\sytem32\drivers\etc\hosts file into an open text editor page and make sure the first line after all the comments is
Code: Select all
127.0.0.1 localhost
If not then add that line after the commented lines so it is the first line to be read, then save it.

Next open \xampp\mysql\bin\my.ini file in your text editor (drag it into an open text editor page) and uncomment this line (remove the # character) so it looks like this
Code: Select all
bind-address="127.0.0.1"
Save the file and restart Apache and MySQL, then try again to login to phpMyAdmin.

I am also assuming that you did not set a password for user root anywhere.
If you think there may still be a password for user root somewhere then right click on this bat file and run it as an administrator:
\xampp\mysql\resetroot.bat


Also clear your browser's cache (Temporary Internet Files) from time to time when working at localhost level so you have a fresh page served instead of a old cached page.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: MySQL said: #1045 Access denied

Postby 3iglobal » 07. March 2012 11:54

Thanks for the prompt response.
It says root@server because I have set an alias for my system. I have set up a network of 6 computers and each is assigned a static IP. I have assigned 192.168.1.3 and the alias "server".
All the other systems access this system as "server".
Does that effect the above solutions or are there any alternate solutions?

Thanks and Regards
3iglobal
 
Posts: 7
Joined: 06. March 2012 13:25
Operating System: Windows 7 Ultimate 64-bit

Re: MySQL said: #1045 Access denied

Postby Sharley » 07. March 2012 12:17

By default, XAMPP and it's components are compiled and configured to work with localhost (127.0.0.1).
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: MySQL said: #1045 Access denied

Postby 3iglobal » 09. March 2012 08:13

I understand that. But I've been using Xampp for over 2 years now with this setup. This is the firs time I am facing this issue. Is there any other way to access phpmyadmin? Can I delete the root user and create a new one or login using an alternate account?

Thanks and regards
3iglobal
 
Posts: 7
Joined: 06. March 2012 13:25
Operating System: Windows 7 Ultimate 64-bit

SOLVED: MySQL said: #1045 - Access denied for user 'root'@

Postby ngenge » 17. July 2012 16:28

I got your great luck Sharley! :D
you helped me a lot. I can solve that 1045 error changing 'cookie' instead 'config'.
May I know the reason how it is solved by changing like this? Because I'm curious that I only change the root password then how can it affect to change from
Code: Select all
$cfg['Servers'][$i]['auth_type'] = 'config';
to
Code: Select all
$cfg['Servers'][$i]['auth_type'] = 'cookie';


Anyway, Thank you so much Sharley. You're my hero!! Haha
Best regards,
ngenge


Sharley wrote:In your browser type
http://localhost/phpmyadmin
You should be presented with a login screen where you enter the username root and then leave the password box blank.

If you don't see a login screen then open the file \xampp\phpmyadmin\config_inc.php in your text editor and look for this line and change it to look like this if required
Code: Select all
$cfg['Servers'][$i]['auth_type'] = 'cookie';
Do not change or add anything else.

Save the file and restart Apache and MySQL then follow the above login procedure.
You will need to accept cookies when prompted.

Good luck
ngenge
 
Posts: 1
Joined: 17. July 2012 16:15
Operating System: window 7

Re: MySQL said: #1045 Access denied

Postby JonB » 18. July 2012 14:31

The reason is that when there is no password, the authentication (auth) method is irrelevant.

The 'config' method requires placing your plain-text password for the user to be authenicated (usually 'root') directly in config.inc.php (bad bad bad) -- while 'cookie' uses a form of 'basic authentication' that prompts for MySQL username(s) & password, and on 'success' writes a session cookie to your browser's cookie cache/store.

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 64 guests