I have spent hours just trying to set up MySQL and still no success(on windows). I am starting to doubt my very name.
When I try to configure it says:
"The security settings could not be applied. Error Number 1045. Access denied for user 'root'#'localhost' (usin passwrd: NO)
And before it kept rejecting my password.
http://www.wampserver.com/en/download.php
Use it, love it, stop wasting time and get programming!
OR YOU CAN TRY THIS....
If you actually have set a root password and you've just lost/forgotten it:
Stop MySQL
Restart it manually with the skip-grant-tables option: mysqld_safe --skip-grant-tables
Run the MySQL client: mysql -u root
Reset the root password manually with this MySQL command: UPDATE mysql.user SET
Password=PASSWORD('password') WHERE User='root';
Flush the privileges with this MySQL command: FLUSH PRIVILEGES;
From http://www.tech-faq.com/reset-mysql-password.shtml
MySQL - ERROR 1045 - Access denied
I had this (frustrating) issue as well.
What I did was:
Uninstall MySQL
Delete the folder C:\ProgramData\MySQL\
Install MySQL again
Hope it works for you as well.
Related
so i installed the MySQL application for the first time. firstly i saw the command line client is not opening so i searched for solutions. they said i must go to the bin directory and run it manually. and after i run the cmd mysql -uroot -p and run it and enter password, it gives me the error: ERROR 1045 (28000): Access denied for user 'root'#'localhost' i tried every single solution on stackoverflow including disabling permissions, running manually which i mentioned above, starting the service from service.msc, running it with password and without.... it just doesnt want to work.
appreciate any help in advance.
GENERIC MYSQL INFO
To start with, read the mysql manual: https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
The steps will show you how to shut down the service and start it with an overriding command that doesn't require passwords, then you reset the password. From the manual:
Stop the MySQL server, then restart it with the --skip-grant-tables option. This enables anyone to connect without a password and with all privileges and disables account-management statements such as ALTER USER and SET PASSWORD. Because this is insecure, you might want to use --skip-grant-tables in conjunction with --skip-networking to prevent remote clients from connecting.
Connect to the MySQL server using the mysql client; no password is necessary because the server was started with --skip-grant-tables:
shell> mysql
In the mysql client, tell the server to reload the grant tables so that account-management statements work:
mysql> FLUSH PRIVILEGES;
Then change the 'root'#'localhost' account password. Replace the password with the password that you want to use. To change the password for a root account with a different hostname part, modify the instructions to use that hostname.
MySQL 5.7.6 and later:
mysql> ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
MySQL 5.7.5 and earlier:
mysql> SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass');
Or directly on the user table:
UPDATE mysql.user SET password=PASSWORD('mynewpassword') WHERE user='root';
XAMPP SPECIFIC
Stop the MySQL service. Open a command window. Change to the XAMPP MySQL directory:
> cd \xampp\mysql\bin\
Run the service without security (note you are running mysqld, not mysql):
> mysqld.exe --skip-grant-tables
The MySQL service will be running in this window, so open another command window and switch to the XAMPP MySQL directory:
> cd \xampp\mysql\bin\
Run the MySQL client:
> mysql
Update the password:
mysql> UPDATE mysql.user SET password=PASSWORD('mynewpassword') WHERE user='root';
Exit MySQL:
mysql> \q
Use task manager to cancel the mysqld.exe that is still running. Restart the mysql service.
I got the answer myself. Seemingly, if you get this error, it means that you need to reset your password. You can learn how to do that in MySQL from this link.
And don't forget to change the 5.7 version with your currently installed version in using commands (mine was 8.0).
After that, everything was working fine for me.
I am doing an online course from coursera where they tolm me to install phpmyadmin.
NOW I am a total beginner in this thing so I am not able to do much research upon that and now somehow, after I installed MySQL and phpmyadmin, in the localhost, I am getting some errors, is that common? Because the other participants in the course are not getting them. If that's fatal or will limit some of my obvious abilities, please tell me how to cure it.
BTW If you didn't noticed the errors are:
mysqli_real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'#'localhost' (using password: YES)
and
Connection for controluser as defined in your configuration failed.
Some more details:
PHP version is 7.4
Operating System is Ubuntu 20.04
I was using MaridDb solved this issue with the following:
sudo systemctl stop mariadb
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
You will see a prompt like below:
Type help; or \h for help. Type \c to clear the current input statement.
MariaDB [(none)]> FLUSH PRIVILEGES;
For MySQL 5.7.6 and newer as well as MariaDB 10.1.20 and newer
ALTER USER 'root'#'localhost' IDENTIFIED BY 'new_password';
OR:
For MySQL 5.7.5 and older as well as MariaDB 10.1.20
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('new_password');
I've just installed LAMP on a new PC, and got the same problem.
Linux Mint 20 + MariaDB.
Password for root and phpmyadmin was already ok, but the error was still there.
Finally I discovered another configuration file, that sets the phpmyadmin password; you have to edit it:
$ sudo nano /etc/dbconfig-common/phpmyadmin.conf
set the correct password (= dbc_dbpass) for user dbc_dbuser='phpmyadmin'
Use ctrl-O to save, then ctrl-X to exit. Then launch the command:
$ sudo dpkg-reconfigure phpmyadmin
(Do NOT reinstall the DB).
In my PC il works!
I had a similar issue with mysql 8.0.22 and Ubunutu 20.04.3lts after installation despite setting up the phpmyadmin user during the installation it wouldn't let me in with the password I set.
I solved it by logging in at the command line using
sudo mysql
Then changed the password by the below and I could then log in
ALTER USER 'phpmyadmin'#'localhost' IDENTIFIED BY 'new-password-here';
I had the same problem by changing the password of the root user and the problem was solved by changing the content of the config.inc.php file inside the xampp\phpMyAdmin folder.
Open the file with Notepad, then enter the defined password in front of the password field and that's it
Error image
---The part where the password must be entered
I'm having a weird problem where I cannot login to my MySQL server with sudo as root on a ubuntu 19.10 server. I want to be able to reset my root password.
The error message I got was:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
Anyone had similar problems? Thanks!
Ok - so I solved this problem myself.
The correct way of resetting the root password for mysql is to:
Stop all mysql server sessions.
Start mysqld manually using - this basically tells MySQL to skip any credentials check and allow anyone to login, hence you want to skip-networking to avoid network users.
sudo mysqld --skip-grant-tables --skip-networking
Use this to login as root:
sudo mysql -u root
In the mysql prompt, do:
FLUSH PRIVILEGES;
SET PASSWORD FOR root#'localhost' = PASSWORD('password');
FLUSH PRIVILEGES;
Stop mysqld and restart mysql normally (you may need to kill the mysqld process).
In my case, there was some problems with the installation and the /var/run/mysqld folder was not correctly set up. It may be a bug with MySQL and it was not properly reported.
After creating the folder with the correct setmod (user:group is mysql:mysql) mysqld runs without any problem.
I understand that this is the safest way to change or reset mysql root password. I'm doing it because 8 times out of 10 the installation program won't prompt me for a root password.
So I run commands:
sudo /etc/init.d/mysql stop
sudo mysqld_safe --skip-grant-tables &
sudo mysql -u root
use mysql;
Then, depending on your version of mysql or maria you're using you type:
update user set password=PASSWORD("mynewpassword") where User='root';
or
ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
In my case I typed the first one. Then I refresh privileges by:
flush privileges; and then I exit out of mysql by typing: quit.
At this point everything went well. Then I restart mysql server by:
sudo /etc/init.d/mysql start
I get "OK" from the terminal. However, when I attempt to log in as root
I get pleasant error message saying:
ERROR 1698 (28000): Access denied for user 'root'#'localhost'
I'm 100% confident that I'm typing correct password. Why is this happening ?
Problem resolved by backing up all important data and reinstalling the operating system. As turned out I had some broken packages that affected how mysql authentication worked. Standard steps to fix broken packages was no use so I wiped out HDD and started over.
MySQL was installed without any hiccups and was even prompted for a root password to be set. Now MySQL authentication works like a charm.
Try this out :- It Works for me..!!
Stop the MySQL server process.
service mysql stop
Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password.
mysqld_safe --skip-grant-tables > /dev/null 2>&1 &
Connect to mysql server as the root user. And Setup new mysql root account password.
mysql -u root -e "use mysql; update user set password=PASSWORD('NEW-PASSWORD') where User='root'; flush privileges;"
Exit and restart the MySQL server.
service mysql restart
Note: You may need to wait after mysqld_safe command, before you can run subsequent mysql command.
Now run :- mysql -u root -p
I cannot login as root#localhost in MySQL.
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I have tried the following method which I suppose most of the users would have heard of:
stop mysql
mysqld_safe --skip-grant-tables
login as mysql -u root
UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
FLUSH PRIVILEGES
quit
This won't work. Is there any other suggestion?
After I login in step 3, when I SELECT * FROM mysql.user, the result is empty. It seems that there is no root user.
OS: OS Yosemite. I use the MySQL comes natively with the Macbook Pro.
The problem seems to occur when I try to change the connecting socket from /tmp/mysql.sock to /var/mysql/mysql.sock
Thank you very much.
I've found the following command's work on my MySQL installation in Yosemite.
Stop MySQL
mysqld_safe --skip-grant-tables
login as mysql -u root
use mysql;
UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
FLUSH PRIVILEGES;
Quit MySQL and restart as normal
you could try mysql_install_db in the terminal , this will create system tables and should restore root password to default which is nothing. see if it has any other implications that affects you here.