permission denied for root user in mysql - mysql

I have accidentally did some thing in MySQL database and broke MySQL.
:~# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
:~# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
tried all the possible solution but still couldn't able to login to MySQL.
I have tried reinstall the package still same error.

Seems like you haven't configured mysql completely, try:
mysql_secure_installation

Related

ERROR 1045 (28000): Access denied for user 'zijieyu'#'localhost' (using password: NO)

I just installed mysql and set the path. But after I write mysql -v in my Mac terminal, it shows "ERROR 1045 (28000): Access denied for user 'zijieyu'#'localhost' (using password: NO)". I think it should be root#localhost. And I can use mysql -u root -p to use database. Please tell me how to solve this problem? I just want to set default database is root not zijieyu.

mysql setup issue on Mac system

I have install mysql using command brew install mysql. After that set password for root. still I am not able to login in mysql shell
brew install mysql
sheetal$ mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
sheetal$ mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
sheetal$ sudo mysql -uroot -p
Password:
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
sheetal$ mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
Error: Access denied for user 'root'#'localhost' (using password: YES)
Seems you forgot your password. To reset the root password, you need to start your mysql server with --skip-grant-tables option. This allows you to log in to your mysql console without any password.
$mysql.server start --skip-grant-tables
$mysql
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'#'localhost' IDENTIFIED BY 'newpassword';
mysql> quit;
$mysql.server restart
Now you should be able to log in with your newpassword.
There're other ways to do this but I find this to be the easiest.

ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO) on windows os XAMPP

I am new to mysql, and I have installed XAMPP on my PC. I have tried all the ways suggested here in order to solve this error:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
after typing mysql -u root, I even changed my password to a new one, but it didn't help. What could I do to make my mysql working?

mysql start ubuntu - ERROR 1045 (28000): Access denied for user 'username'#'localhost' (using password: NO)

I cant start mysql server on local machine.
Run mysql start, display error:
ERROR 1045 (28000): Access denied for user 'username'#'localhost' (using password: NO)
How solve this issue?
try entering
mysql -uroot -p
it will ask you to put in your password then
it looks like your MySql is running
and if that doesnt work do
mysql start -uroot -p
alternatively look at this https://coolestguidesontheplanet.com/start-stop-mysql-from-the-command-line-terminal-osx-linux/

Cannot run MySQL - ERROR 1045 (28000)

I am on Ubuntu. I did not set any password to my root account during the MySQL installation process. I am trying to run MySQL with
mysql -u root
However, I can't, ending up with the following access denied error.
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
Then, I thought it might be due to the password issue. I tried this and enter an empty password and hit the Enter key.
abc#ubuntu:~$ mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
Then, I even tried entering a password (my user password on the computer). I ended up with this
abc#ubuntu:~$ mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I have seen some solutions, but most of them require to run MySQL first in order to resolve the issue. However, I find myself not able to do anything, stuck here.
You must login from root so for this you must write sudo like:
sudo mysql -p
First give your system password
then it asking for mysql server password, in my case '123'
Then you acces your database.
Your command looks ok. It looks like you need to reset the root password
Resetting MySQL root password