MySQL error 1045 acces denied

Alles, was MySQL betrifft, kann hier besprochen werden.

MySQL error 1045 acces denied

Postby patratel » 08. June 2013 14:34

Hi,
I have xampp 1.8.1 on win xp sp3.
I got this error when I try to connect with mysql Client (cmd C:\xampp\mysql\bin\mysql -u root -p):
"ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)"
I can connect with "mysql -u root" (without password) but if I try something, I get access denied.
If I try "mysql -u root -p mysql", I get "ERROR 1049 (4200): Unknown database 'mysql'".
I can connect from phpMyAdmin, and I can do anything there. But in command prompt, when I tried mysqladmin flush privileges (or something else), it says "unknown command" or other errors.
I tried from SQL console in phpMyAdmin to add for root hosts 'root'@'localhost' , 'root'@'127.0.0.1' , 'root'@'::1', 'root'@'%' with
CREATE USER 'root'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

For 127.0.0.1 I got "#1396 - Operation CREATE USER failed for 'root'@'127.0.0.1' ", for the others worked.

There are few days since I struggle with this thing, I can really use some help. Thanks.
patratel
 
Posts: 3
Joined: 07. June 2013 15:22
XAMPP Version: 5.6.3
Operating System: win xp

Re: MySQL error 1045 acces denied

Postby patratel » 11. June 2013 14:39

Hi,
I've dropped XAMPP and I've installed Apache 2.4.4, PHP 5.4.16, MySQL 5.6 and phpMyAdmin 4.0.3 (after I formatted my pc :)).
It seams it works fine for now, I'll test further, hope to be ok.
Thanks
patratel
 
Posts: 3
Joined: 07. June 2013 15:22
XAMPP Version: 5.6.3
Operating System: win xp

Re: MySQL error 1045 acces denied

Postby Neilbritto » 07. October 2013 17:29

I have Xamp 1.8.2 and have the same issues:

The problem is I could not remember the root password I set on the XAMPP Security page and because I could not log into PHPmyAdmin and create a database I assumed I should reset the password for the root account. No changes I make in PHPMyAdmin's security page or in the command line seem to bear any positive results for me.

Though it seems this issue has been addressed numerous times already, I've read numerous articles here and on different sites regarding this error and still I find no thread with the answer.

What I have done is repeat a few flavors of the below, numerous times, to get going. I still cannot get into phpMyAdmin or do anything in the command line with the root account.

I have:

reset my root Passwords for Windows Systems via a file (mysql-init.txt) containing these commands:

UPDATE mysql.user SET Password=PASSWORD('1234') WHERE User='root';

FLUSH PRIVILEGES;

after turning off MySql, the above commands were run via the command line from my XAMPP shell (run as administrator), the syntax like so:

msyqld --init-file:C:\My Website\Xampp\mysql\mysql-init.txt Note: the file resides in the mysql folder. I placed it there.

I at points I have modified my config.inc.php file, changing the password, but with no real different
outcome.

$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = ''; \ This was changed and matched to changes made to Xampp sec $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = true; $cfg['Lang'] = '';

if i try logging onto the PHPMyadmin webpage with the root account, I get "#1045 Cannot log in to the MySQL
server"

if i try logging into mysql from the command line (run as administrator), with the command: mysql -u root -p (password entered).... I get the same thing.

From the command line i've run this command as well... mysqladmin -u root password 1234 error: "Access denied for user 'root'@'Localhost' (using password: NO)

Also did this: SET PASSWORD FOR root@localhost = PASSWORD('1234'); Seemed to work, but i was still not able to sign on using the account (error 1045)

I've heard it mentioned that there are two root accounts. Can anyone explain or point to the most succinct sources on how I am to start up using the database using these accounts?

Also, can any tell me why I'm able to log into the webpage as any random user ID with no password, but root is

locked out. I'm sure it's because the root account is the most powerful account. How does one get back in the door with root since it seems locked out for it's own good (protected from... me). Forgive my lack of understanding on this. I hope someone can educate me. Please if there is one stupid little thing I'm doing wrong, I'd love to hear about it.
Neilbritto
 
Posts: 3
Joined: 17. November 2011 22:31
XAMPP Version: 5.6.3
Operating System: WIN2k, WIN7

Re: MySQL error 1045 acces denied

Postby dodjy004 » 16. October 2013 06:14

I too am unable to access MySql and when entering via php My admin and receive the error #1045 I have no answer :oops: .
running version 1.8.2
dodjy004
 
Posts: 1
Joined: 16. October 2013 05:53
XAMPP Version: 1.8.3-3
Operating System: windows vista


Return to MySQL

Who is online

Users browsing this forum: No registered users and 5 guests