Well, this is what I can see:
select host, user from mysql.user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| % | me |
| 127.0.0.1 | root |
| ::1 | root |
| localhost | |
| localhost | debian-sys-maint |
| localhost | root |
| ubuntu | |
| ubuntu | root |
+-----------+------------------+
I entered as root and would like to change password for user 'me'.
SET PASSWORD FOR 'me'@'%' = PASSWORD('letmein');
Query OK, 0 rows affected (0.00 sec)
Well, no rows affected as we can see.
As for trying to access, the result is as follows:
Access denied for user 'me'@'localhost' (using password: YES)
michael@ubuntu:/var/www/cgi-bin$
So, it mentions localhost, not %.
Could you suggest me how to change the password for 'me' and explain what % is?
The MySQL hostname defines the location of your MySQL server and database. If you want to connect to the information in a MySQL database, you'll need to know the hostname. Again, the hostname is usually localhost, which indicates that the database is running on the same server as your application (e.g. WordPress).
MySQL passwords for users are stored within MySQL itself; they are stored in the mysql. user table. The passwords are hashed by default using the PASSWORD() function.
'%' mean you can login into database from any host connected to those database. You also define your localhost as host if you want to access database from localhost.
to change your password:
SET PASSWORD FOR 'me'@'%' = PASSWORD('letmein');
and don't forget execute:
FLUSH PRIVILEGES;
to commit your change. Please look at MySql Account Management.
UPDATE:
As on your user table I not found username with host = localhost you must create this user first by (here to add user):
Grant all privileges on *.* to me@'localhost' identified by 'letmein';
flush privileges;
You need to set password for localhost
:
SET PASSWORD FOR 'me'@'localhost' = PASSWORD('letmein');
FLUSH PRIVILEGES;
%
means remote hosts can login to MySQL server from any other server whereas localhost means you can login to MySQL server only from same machine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With