I just installed MySQL server on my Ubuntu machine. All installed ok, when it asked for my password, I simply hit 'enter' so as to leave the password blank. Now when I try to login:
mysql -u root -p
and simply hit enter, I get the following error:
ERROR 1698 (28000): Access denied for user 'root'#'localhost'
I don't understand what the error is or how to fix it. Please can someone help? I've tried to read the MYSQL Docs but I don't understand what they're saying.
I also get an "Access Denied" page when I try to access phpMyAdmin
Had the same issue. Executing with Super user privileges worked for me.
sudo mysql -u root -p
Have you tried to ommit -p for password free login?
mysql -u root
Related
I got this error when I tried to connect to local host, but it works fine last week. "Your connection attempt failed for user 'root' to the MySQL server at localhost:3306:
Access denied for user 'root'#'localhost' (using password: YES)"
I followed several ways in terminal: sudo mysql -u root -p
after i put my password, it says:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
no matter what i try, it always says access denied.
Would be appreciated if anyone could help!
As someone said in the comments, it seems you are using the wrong password. This link explains how to reset the root password if ever you need it https://phoenixnap.com/kb/how-to-reset-mysql-root-password-windows-linux
sudo service mysql restart
But I get
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
I then enter and can enter mysql without any problem.
mysql -u root -h localhost -ppassword databasename
My question is that, can I restart mysql service without getting that error by maybe supplying hostname and password straight away.
somtimes error occurs but changing mysql password can solve the error.
and once you changed your password, you're error free.
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!
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
Please forgive me for being a complete beginner:
I am trying to log into my very first mySQL database that I installed using easyPHP on my windows machine, using the cmd line. I am going to the \mysql\bin and entering the command:
mysql -u root
in order to log in, but I am getting the following message:
error 1045 (28000) access denied for user 'root'#'localhost' (using password: YES)
Why is it using the password "YES"? Shouldn't there be no password at all? Do I need to restart mySQL or something? If so, how do I do that? If it's relevant, I did try to create the database using phpmyadmin, but had a few problems entering columns and decided I'd be better off working from the command line so I could learn all the commands as I went along.
Please keep in mind that this is my first time ever trying to work with a database, so be kind to me!
To have mysql asking you for a password, you also need to specify the -p-option:
mysql -u root -p
When logging into MYSQL using the command line, you also have to specify the password if any. Your error message is telling you that the user "root" has a password attached to it. Not necessarily that the password is "YES" when you were installing easyPHP, it should have either provided you with a default password or allowed you to enter a password of your choosing.
According to the documentation of easyPHP:
[v1.6] My scripts worked perfectly with 1.5 but now I get this error : Warning: Forbidden access for user: 'user#localhost' (password: YES) when I want to connect to MySql.
Only the root user (without password) has the rights to connect to the database. Either modify your scripts to use it, or add the user you need (phpMyAdmin/users and privileges: See phpMyAdmin's documentation for more information).
mysql -u root -p
Now if you changed your root user password, you will need to specify that when prompted. Otherwise simply hit <Enter> on your keyboard.
If you FORGOT the password to root, and have changed it, you will have to subsequently reinstall easyPHP.
agk-hp:~/$mysql
ERROR 1045 (28000): Access denied for user 'greg'#'localhost' (using password: NO)
agk-hp:~/$sudo cat /etc/mysql/debian.cnf|grep password
password = t7753my3D2x4yfQm
agk-hp:~/$mysql -u debian-sys-maint -p
Enter password: {t7753my3D2x4yfQm}
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> use mysql;
mysql> grant all privileges on *.* to 'root'#'localhost';
mysql> grant all privileges on *.* to 'greg'#'localhost';
agk-hp:~/$mysql
mysql>
A modification for mysql- 5.7.10 on mac mac el capitan
sudo /usr/local/mysql/support-files/mysql.server stop
sudo mysqld_safe --skip-grant-tables
Now open new window/tab on terminal and type
"mysql -u root"
use mysql
update user set authentication_string=password('yourpassword') where user='root';