After successfully initializing mysql, it denies access to begin the mysql command.
mysql -u newkelsie
I never recalled setting a password, but I did hit blank enter once when it asked for a password so I am not sure if that might be the problem or if I could go back and set a password. I'm using the Administrator: Command Prompt so I believe I should have all access, but instead I'm getting a common error.
Error 1045 <28000>: Access denied for user 'newkelsie'#'localhost' <using password: NO>
I've also been getting the error when I put a password in.
One of the other suggestions to answer this problem I tried was creating a document in bin called "mysql-init.txt" It's contents include:
ALTER USER 'newkelsie'#'localhost' IDENTIFIED BY 'kelsie';
Which is supposed to set my password upon initialization. However, this is not the case. Is there a way I can get mysql running on my computer without the password?
Related
Well, I'm using Ubuntu 20.04 and I have installed MySQL some months ago. Actually MySQL version is 8.0.30.
I'm trying to get in the mysql console, but it gives me that neither root nor my personal user have permissions on MySQL.
What I've already tried:
skip-grant-tables => One of the solutions was putting this option in one of the MySQL configuration files, and then alter the root password. but when I try to change the root password, it gives me that I'm using the skip-grant-tables option. After trying this, and of course, using flush privileges and restarting the service after changing it, I get:
ERROR 1396 (HY000): Operation ALTER USER failed for 'root'#'localhost'
alter user => I tried many commands with alter user like:
alter user 'root'#'localhost' identified by 'My_password';
alter user 'root'#'localhost' identified with native_mysql_password by 'My_password';
set password for 'root'#'localhost' = PASSWORD('My_password');
But all theses commands give the error ERROR 1396 (HY000): Operation ALTER USER failed for 'root'#'localhost'.
Put the right authentication_string => Yes, I had checked this column to the root user, and it still giving me the same thing:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
No success at all. The last one even gives me a syntax error. But all this attempts gave me some information:
debian.conf => I did a cat in this file, and I found out that root user is not in there, even if it's in the Users table inside mysql database. But I can access mysql console with debian-sys-maint, using the password given in the file.
Permissions => I doesn't have any permissions with root.
root password => I have set the authentication_string to the root user inside users table to a very strong password, and even using it, I does not have permissions to enter mysql console.
Password validation => I have changed the global variables of password validation so I can change my password to a weak one. But when I restarted the MySQL service, it went back to the default configurations. It bothers me, but I can get along with it.
So what I'm looking for is: how can I give permissions to my root user access MySQL console? Should I recreate root user? Or is there another way to fix this?
EDIT1: PASSWORD function does not work for some reason.
EDIT2: I'm not able to create a root user. It gives me an error saying that I don't have permission to do so. It looks like mysql is not recognizing 'root' as a user. When I try "GRANT ALL" to 'root', it says that I don't have permission to create it, but it is already in the users table.
I have completely locked myself out from MySQL.
The solutions I find out there suggests to run sudo mysql -u root which used to work but I can't even login that way.
Error: ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
I tried to reinstall MySQL but that didn't help either since I am still being prompted for a password, how is this even possible?
Anyone has experience with this?
Solution
When I uninstalled the software I didn't do all the necessary steps, I followed this guide in order to re-install it and I now have access again!
The syntax you are using assumes that there is no root password set. The error messages shows that there is a password set. Berto99's answer shows you how to get the system to prompt for a password. Note that this "root" account is not the same as a "root" account configured on your host - but may have been configured to use the same password.
If you don't know what that password is, you can force the system to change it by starting the mysql service with an init script which changes the password e.g.
ALTER USER 'root'#'localhost' IDENTIFIED BY 'NewPassword';
For the last few years I logged in to my local mysql database by simply typing mysql on Terminal. But now, for some reasons I found that this doesn't work right now, with the access denied error:
ERROR 1045 (28000): Access denied for user 'me'#'localhost' (using password: NO)
Now I must log in to type the following:
mysql -uroot -proot
This is quite painstaking, so I rather want to swich back to when I just type in mysql to log in to the database.
I don't set it as an alias in my zsh shell, but I cannot remember how I set it way before, such that I don't need to type in my user and password.
So how can I set it such that I log in with mysql command only? I use Mojave beta.
I think your current connection has set up with a password try to create new connection with null or leave it blank when asking a password :)
I have wamp running locally on my computer and was working just fine. I have a web application based on PHP and MySQL. I am using a password for the connection.
Suddenly, I got the following error:
MySQL ERROR 1045 (28000): Access denied for user 'root'#'localhost'
(using password: YES)
I tried to follow the answers of this post on stack. But nothing worked.
Ounce I open the mysql cmd and write down the password, it will close immediately.
I even used MySQL workbench, and I was successful to enter but on a different user with password. But the user I am using where my databases resides, is not accessible anymore.
I have a db called ncd, where I can see it on the other user but as empty.
Could I restore the data from wampserver ?
You can check your db on /mysql/ folder and them store it. And move to another mysql with another account and restore your db with same folder as above me talk it.
The detailed Oracle setup that followed the beginning installation prompted me for a password, and to reenter that, but never asked what a username should be. So I don't know what mine is.
It's 7 years since set up MySQL on a Windows machine, and the process seems to have gotten more complicated. If it's any indication of where I am in all of this, just to see what would happen I typed "MySQL" at my command prompt, and it returned with "ERROR 1045 (28000): Access denied for user 'ODBC'#'localhost' (using password: NO)"
I have a JDBC connection (I'm ordinarily going in through PHP), but I haven't filled in the resin-web.xml with anything yet because I don't know what my MySQL username is.
Thanks for any help.
root is the default user in MySQL.