MySQL can't connect - mysql

I try to access MySQL but I can't. I wrote skip-grant-tables in the mysql configuration and restart it but it still doesn't work.
$ mysql -u root -p
ENTER PASSWORD: *****
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I also try to connect phpmyadmin but I can't
Cannot log in to the MySQL server
and
mysqli_real_connect(): (HY000/1045): Access denied for user 'root'#'localhost' (using password: YES)

Error meaning:
SQLSTATE[28000] [1045] Access denied for user 'user'#'localhost'
(using password: YES)
Possibilities:
Typo in password
Accessing from the wrong host
User doesn’t exist
But in your scenario, I don't see a chance for case 3. But cases 1 and 2 are possible.
Can you check if your password is correct, i,e. no typo in your password.
If you have a wrong password you can reset the admin/root password by starting the MySQL in safe mode.
UPDATE user SET password=PASSWORD("new_password") WHERE User='root';
In the second case, the reason is MySQL allows user access only from hosts defined in the MySQL user table.
it can be resolved by starting the MySQL in safe mode and
UPDATE user SET host='hostname' WHERE user='username';

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

How to access mysql with asking the root password

I have installed MySQL community edition in the Centos machine, I want to access the MySQL service by just typing mysql instead of mysql -uroot -p<password>, I have done so sort configuration adding the username and password in the my.cnf that is not gone work anymore it throwing
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using
password: YES)
As error is defined ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES), you are using the wrong password for accessing mysql.
You can also update username & password using cli
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; & restart mysql using sudo service mysql restart
Thanks

I can't connect to MySQL server in any way (on Windows)

My problem is below:
C:\Users\ordek> mysql
ERROR 1045 (28000): Access denied for user 'ODBC'#'localhost' (using
password: NO)
C:\Users\ordek>mysql -u root
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using
password: NO)
C:\Users\ordek>mysql -u root -p
Enter password: ****
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using
password: YES)
I tried lots of solutions before asking here. I've even tried reinstalling MySQL but surprisingly this problem still exists. In Workbench I can't connect to any connection. I always login to the MySQL server as superuser and subsequent attempts to change privileges didn't work because I can't log into MySQL in the usual ways.
In Workbench it doesn't matter which user: root or not, you'll get this message.
[Window Title]
MySQL Workbench
[Main Instruction]
Cannot Connect to Database Server
[Content]
Your connection attempt failed for user 'user1' to the MySQL server at
127.0.0.1:3306:
Access denied for user 'user1'#'localhost' (using password: YES)
Please:
1 Check that MySQL is running on address 127.0.0.1
2 Check that MySQL is reachable on port 3306 (note: 3306 is the default,
but this can be changed)
3 Check the user user1 has rights to connect to 127.0.0.1 from your
address (MySQL rights define what clients can connect to the server and
from which machines)
4 Make sure you are both providing a password if needed and using the
correct password for 127.0.0.1 connecting from the host address you're
connecting from
In "test connection"(WORKBENCH) I always get this message:
[Window Title]
MySQL Workbench
[Main Instruction]
Failed to Connect to MySQL at 127.0.0.1:3306 with user user1
[Content]
Access denied for user 'user1'#'localhost' (using password: YES)
In my mind this is a problem with privileges, but I don't know what to do because I'm a beginner at MySQL. If you know how to overcome this problem, please let me know.
I believe you installed MySQL (windows) using .msi package. As it .msi allows you to do the installation step by step and you can set "root" password.
If you have root password, make sure MySQL services are started.
Control panel > services > Mysql
The user ordek seems unknown to mysql . Switch to root user and it will work .
If this is not possible , or the root password is unknown , re-install mysql , make a note of the root password for future use , create the ordek user and assign it the access rights it needs .

How do I resolve a "warning" that says that it could not connect to the sql server using password:YES?

Warning: mysql_connect(): Access denied for user 'msuparam_17'#'localhost' (using password: YES) in /home/msuparam/public_html/17database/Formfeed/Formreg.php on line 11
Could not connect: Access denied for user 'msuparam_17'#'localhost' (using password: YES)
Access denied for user 'msuparam_17'#'localhost'
Access denied means that you were able to establish a connection to the server, but it has rejected your credentials.
Either you have typed the wrong username, the wrong password, or this user does not actually have privileges to login.
If you can login to the database as an authorized user, verify this user actually exists, and is permitted to login.
mysql -u root -p
Password:
mysql> use mysql;
# Verify user actually exists
mysql> SELECT User,Host FROM user WHERE User="msuparam_17";
# Check permission for user
mysql> SHOW GRANTS FOR 'msuparam_17'#'localhost';

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