I forget the mysql password and cant change it
Hello,
I just set a password for mysql in Ubuntu webmin and when i enter that it returns error. I try some methods but one of them was better. I try this codes: 1. /etc/init.d/mysql stop (done without error) 2. mysqld_safe --skip-grant-tables & (done without error) 3. mysql -u root (connect to mysql) 4. use mysql; update user set password=PASSWORD(“PASSWORD”) where User=’root’; flush privileges; quit; also step 4 done completely and i receive these massages : "Query OK, 3 rows affected (0.00 sec) Rows matched: 3 Changed: 3 Warnings: 0 Query OK, 0 rows affected (0.00 sec) Bye" finally I reset mysql with these two commands : /etc/init.d/mysql stop /etc/init.d/mysql start but when i use the command "mysql -u root -p" to enter the passwort it says : "access denied for user root at localhost (using password: yes)" why I cant enter now ? does anyone have solution or another method for this? |
Quote:
|
Quote:
can i get root shell for mysql just with the "sudo -s" command ? I just use this command for setting password : password=PASSWORD(""); then : select user , password , host from user; and I saw that the password of all users is blank but when i want to enter mysql (after restarting mysql) i get this error : "Re: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)" why I cant login when I dont set any password ? please help me, thanks a lot ... |
Quote:
Quote:
|
Quote:
how can I completely remove mysql with all of its data then install it again ? I removed and reinstall it through wembin but the password didnt change. |
Quote:
Type in "sudo -s" Type in "mysql " That's it. After that, Do What you'd like. |
did you state you uninstalled mysql then reinstalled mysql
as i recall the defaults are user = USER password = PASSWORD that is why it is very important to set them |
I think your syntax may be a lil off.
1.Reload mysql with dropped privileges. 2. type "use mysq;" 3. Run the following : Code:
FLUSH PRIVILEGES; |
thanks my friends, I finally made it. I think its a good experience for everyone
so I want to share it : 1. ( sudo -s), then (mysql) doesn't work ! 2. ( mysqld_safe --skip-grant-tables & mysql -u root use mysql; update user set password=PASSWORD(“PASSWORD”) where User=’root’; flush privileges; quit; ) it just change the root and other users passwords. 3. this way I could solve it : ( mysqld_safe --skip-grant-tables & mysql -u root use mysql; GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'password'; SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password'); ~~> I think this part is not needed but i use it. flush privileges; ~~> this part is not needed i just add it for fun :D quit;) |
All times are GMT -5. The time now is 05:55 AM. |