Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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?
You need to get a root shell (either "sudo -s" or "su - root"), then just type in "mysql".
You need to get a root shell (either "sudo -s" or "su - root"), then just type in "mysql".
can you exactly say in witch step should I get a root shell ?
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)"
can you exactly say in witch step should I get a root shell ?
can i get root shell for mysql just with the "sudo -s" command ?
Yes, that's why I said to Do exactly that before.
Quote:
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)"
you know, my problem is just that I cant enter to a mysql that hasnt any password. in spite of it hasnt password but asks me to enter the password !!
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.
you know, my problem is just that I cant enter to a mysql that hasnt any password. in spite of it hasnt password but asks me to enter the password !!
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.
FLUSH PRIVILEGES;
SELECT Host,User,Password FROM user WHERE User='root'; #<<<this is so you can compare and see what you have a root before the change.
+-----------+------+-------------------------------------------+
| Host | User | Password |
+-----------+------+-------------------------------------------+
| localhost | root | *HUNK OF HASH SHOWS HERE VERSION 1 |
| 127.0.0.1 | root | *HUNK OF HASH SHOWS HERE VERSION 1 |
+-----------+------+-------------------------------------------+
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password'); #<<<not sure but I think you need to define where root will be connecting from with the ip.
SELECT Host,User,Password FROM user WHERE User='root'; #<<<again, compare the fields to see if your SET/UPDATE took.
+-----------+------+-------------------------------------------+
| Host | User | Password |
+-----------+------+-------------------------------------------+
| localhost | root | *HUNK OF HASH SHOWS HERE VERSION 2 |
| 127.0.0.1 | root | *HUNK OF HASH SHOWS HERE VERSION 2 |
+-----------+------+-------------------------------------------+
FLUSH PRIVILEGES;
exit
Now, reload MySQL as normal and try it out. If that does not work, I think home depo has a sale on hammers this weekend.
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
quit
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.