Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL root@localhost, [email protected] and root@::1 have different passwords - is it normal?

After setting password with this command:

mysqladmin.exe --user=root password <my_password>

I see 3 rows in user table for "root" user: enter image description here http://i.stack.imgur.com/Y4Rkd.jpg and root@localhost has password, while [email protected] and root@::1 do not have password.

Does it mean that I need to set password 3 times for each of these rows? i.e.:

mysqladmin.exe --user=root host=localhost password <my_password>
mysqladmin.exe --user=root host=127.0.0.1 password <my_password>
mysqladmin.exe --user=root host=::1 password <my_password>

Is this normal?

like image 621
i123 Avatar asked May 25 '16 06:05

i123


People also ask

What is the default password of MySQL root user?

The default user for MySQL is root and by default it has no password.

Is MySQL root password important?

Setting the strong passwords for your root user is very important from the security view so that the sensitive data stored in your MySQL database remains protected.

How do I reset my localhost MySQL password?

In the mysql client, tell the server to reload the grant tables so that account-management statements work: mysql> FLUSH PRIVILEGES; Then change the 'root'@'localhost' account password. Replace the password with the password that you want to use.


2 Answers

Yes, this is different accounts. And yes, every account can have own password. You can check details about account names here.
If you don't set host with mysql utilities (such as mysqladmin), by default it will connect to localhost. So, you was really connected under user root@localhost and changed password for this user only. For two other root users you must change password explicitly.

like image 131
Andrew Avatar answered Nov 03 '22 00:11

Andrew


::1 is the IPV6 IP address of 127.0.0.1 (which is IPV4), which is also localhost.

like image 42
Adrian Avatar answered Nov 02 '22 22:11

Adrian