MySQL password

I have a problem with account named “mysql”. It is witohut password and I can’t find it anywhere. It, also, allows acces over PHPMyAdmin by simply entering in USER NAME field “mysql” and PASSWORD field blank.

In Shell I’ve typed:

“mysql> SET PASSWORD FOR ‘mysql’@‘localhost’ = PASSWORD (’******’);”,

and got an error:

“ERROR1133 (42000): Can’t find any matching row in the user table”.

In YaST>Security and Users>User Management, password is set, but no good.

How to set password for that user?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In MySQL credentials include a username, password and Host as you may
know. Let’s see all of them in your table:

use mysql;
select User, Password, Host from User;

The system’s mysql account isn’t the one used to access the database as
far as I know.

Good luck.

kojo1984 wrote:
| I have a problem with account “mysql”. It is witohut password and I
| can’t find it anywhere. It, also, allows acces over PHPMyAdmin by
| simply entering in USER NAME field “mysql” and PASSWORD field blank.
|
| In Shell I’ve typed:
|
| “mysql> SET PASSWORD FOR ‘mysql’@‘localhost’ = PASSWORD (’******’);”,
|
| and got an error:
|
| “ERROR1133 (42000): Can’t find any matching row in the user table”.
|
| In YaST>Security and Users>User Management, password is set, but no
| good.
|
| How to set password for that user.
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIfIoz3s42bA80+9kRAqEuAJ9JOrHc7OGYHuzwVtyY3IhXgLS74QCeIhYT
9ySN+WOpBiVfQLC6nuzFitM=
=+F0C
-----END PGP SIGNATURE-----

1 Open a console and enter

mysql -u root

The default installation has two hosts: localhost and the HOST_NAME of your installation. You can check this by entering

SELECT Host, User FROM mysql.user;

In this statement ‘mysql’ is the database and ‘user’ the table which you are accessing. To assign passwords to the root user on each host, enter

SET PASSWORD FOR ‘root’@‘localhost’ = PASSWORD(‘password’);

SET PASSWORD FOR ‘root’@‘HOST_NAME’ = PASSWORD(‘password’);

replacing ‘HOST_NAME’ with the hostname of your installation.

By using the PASSWORD( ) function, you ensure that the passwords are encrypted. From here on, whenever you wish to log on as root, log on using

mysql -u root -p

and MySQL will prompt you for your password which will not appear on the screen.

2 Removing one or both anonymous users

With the standard installation, there are normally two anonymous users; retaining these makes it easy for you, and for anyone else, to connect to your database. If you choose to retain either anonymous user, you should assign passwords to them with

SET PASSWORD FOR ’ ‘@`localhost’ = PASSWORD(‘password’);

SET PASSWORD FOR ’ '@‘HOST_NAME’ = PASSWORD(‘password’);

replacing ‘HOST_NAME’ with the hostname of your installation. Otherwise you should delete the anonymous user from localhost and you may wish to delete both anonymous users before proceeding further. To delete the anonymous user from localhost enter

DELETE FROM mysql.user WHERE Host = ‘localhost’ AND User = ’ ';

FLUSH PRIVILEGES;

To delete both anonymous users enter

DELETE FROM mysql.user WHERE User = ’ ';

FLUSH PRIVILEGES;

FLUSH PRIVILEGES ensures that the changes take effect immediately and not when Linux is rebooted which could be a very long time in some cases, leaving the anonymous users open for anyone to use.

Sorry is some of this is too basic but I thought it best to put it all in.

Solved

TNX John :smiley: