Cannot run MySQL - ERROR 1045 (28000) - mysql

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

Related

I cant connect mysql

When I try to enter the root user from MySQL Workbench and manually enter it, I get the following error:
your connection attempt failed for user root to the mysql server
Access denied for user 'root'#'localhost' (using password: YES)
I am using mysql -u root code when I want to connect to MySQL via cmd and I get an error in it:
mysql: Unknown operating system character set 'cp857'.
mysql: switch to the default character set of 'utf8mb4'.
ERROR 1045 (28000): Access was denied for the user 'root'#'localhost' (using password: No)
I get a similar error when I try to log in using a password, the only thing that changes is (using password: YES).
What had I better do?
Issue with your password so simply change mysql root password.
here command
mysql -u root
then
mysqladmin -u root password [newpassword]
may help you this.
thanks

ERROR 1045 (28000): Access denied for user 'ODBC'#'localhost' (using password: YES)

In my process to change password of MySQL server, I had to run this line on command
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql root -p
Which later showed error something like
ERROR 1045 (28000): Access denied for user 'ODBC'#'localhost' (using password: YES)
Please help me out with this one guys.
you need simply typing
mysql
without specifying a username will attempt to connect with the non-existent ODBC username, and give:
Error 1045 (28000): Access denied for user 'ODBC'#'localhost' (using password: NO)
instead, try specifying a username that you know, for example:
mysql -u root -p
where -u root specified the username root and -p will make the command prompt for a password.
try with -u parameter,
mysql -u root -p
after typing this command the prompt will ask for the password of the respective user.
That's it

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

when i want start mysql in windwos cmd i got this error
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
what can i do?
mysql -u root -p
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
You can reset your root password. Have in mind that it is not advisable to use root without password.
install MYSQL again and define pass for root and define a user
and after instalation MYSQL work on cmd whit
cd c:\Program Files\MySQL\MySQL Server 5.7\bin>
then
mysql -u myusername -p
then ask my pass and enter the password of this user name(not root password) and it work
other way for run MYSQL is start menu
in start menu find folder that named MySQL and expand it
and run MySQL command line client
you can find your password by
# cat /var/log/mysqld.log | grep password
These errors sometimes due to DNS problem. To fix it, execute mysqladmin flush-hosts to reset the internal DNS host cache.

permission denied for root user in 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

MY SQL help - ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)

I am trying to copy an SQL database from the folder using this command:
sudo mysql -u root globe_bank
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
sudo mysql -u root -p globe_bank
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I rang apple support and we changed the password of the root directory, they confirmed it was successful still getting this message. I have tried a few of the suggestions on similar threads, and mostly I get command not found.
When I type in mysql my connection ID is 19.
Any ideas or help is appreciated
I have faced the same issue on mysql Ver 15.1 on Amazon Linux 2 and the following worked for me:
Try entering the password on the same line.
I.e. instead of $mysql -u root -p, pressing Enter and then entering password after the prompt, do this:
$mysql -u root -p\<password>
Remember there is no "space" between -p and \<password>, I think you have got a space there!