PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label mysql-error-1045. Show all posts
Showing posts with label mysql-error-1045. Show all posts

Saturday, February 5, 2022

[FIXED] Access denied for user 'root@localhost' (using password:NO)

 February 05, 2022     mysql, mysql-error-1045, wordpress     No comments   

Issue

I'm new to MySQL, I'm trying to run WordPress in my Windows desktop and it needs MySQL.

I install everything with Web Platform Installer which is provided by Microsoft. I never set a root password for MySQL and in the final step of installing WordPress, it asks for a MySQL server password.

What is the default password for root (if there is one) and how to change it?

I tried:

mysql -u root password '123'

But it shows me:

Access denied for user 'root@localhost' (using password:NO)

After this I try:

mysql -u root -p

However, it asks for a password which I don't have.


Update: as Bozho suggested, I did the following:

  1. I stopped the MySQL Service from Windows services
  2. Opened CMD
  3. Changed the location to c:\program files\mysql\bin
  4. Executed the command below

    mysqld --defaults-file="C:\\program files\\mysql\\mysql server 5.1\\my.ini" --init-files=C:\\root.txt

  5. The command ran with a warning about character set which I mentioned below

  6. I start the MySQL service from Windows services
  7. I write in the command line

    mysql -u root -p EnterPassword: 123 // 123 was the password

  8. The command line shows the following error

    Access denied for user 'root@localhost' (using password:**YES**)

How do I solve this? I'm waiting to hear from you.


Solution

You can reset your root password. Have in mind that it is not advisable to use root without password.



Answered By - Bozho
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, January 31, 2022

[FIXED] Can't connect to mysql via CLI, but phpmyadmin works just fine

 January 31, 2022     mysql, mysql-error-1045, phpmyadmin     No comments   

Issue

I'm at my wits end trying to solve this issue. I can log into the root account (or any other account for that matter) just fine in PHPmyadmin. Howerver whenever I try to log in via the command line, I get the following error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I've even tried creating a new user, making sure to specify its host as "localhost" and not "127.0.0.1" or "%" and it still doesn't work.

I don't even know where to begin at this point, as I've exhausted all the options from googling "Access denied for user 'root'@'localhost'".

Making a new user in phpmyadmin: adding a new user in phpmyadmin

Trying to log in with it on CLI: trying to log in with new user

Yet (and this is not something easily shown in a screenshot) I can log into phpmyadmin using that same username & password.

This is a production server that I inherited and it's been running just dandy for at least 4 years now, so I really can't tell you much about how it was setup. Also, some of the recommendations of uninstall/reinstall, stop, etc are simply not possible at this time.

My questions (I've seen other 'questions' closed for not stating this clearly):

  1. HELP! Why isn't this working? What am I doing wrong?
  2. I have a 500mb db that I need to import for a new project and even with some settings tweaks phpmyadmin is barfing all over it, so cli was the only other option I could think of. Is there some other possibility that I'm overlooking?

Some additional details:

  • This is on Windows server 2012 R2 SP1
  • Mysql version 5.1.66
  • Non-default port of 3307, I think.

Solution

Specify the port by adding -P3307 to your login string.



Answered By - Redbeard011010
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Thursday, January 27, 2022

[FIXED] phpMyAdmin Access denied

 January 27, 2022     mysql, mysql-error-1045, php, phpmyadmin     No comments   

Issue

phpMyAdmin give this error.

MySQL said:

#1045 - Access denied for user 'root'@'localhost' (using password: YES) 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.


Solution

I had to set:

$cfg['Servers'][$i]['AllowNoPassword'] = true

in apps/phpmyadmin/config.inc.php



Answered By - Zeus
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing