So I have just installed MariaDB on Leap 15 using zypper in mariadb.
When I run mysql_secure_installation, it gives me the error below.
Basically, I cannot change the password.
I looked at many different places around the web, but no luck. The password either fails to change, or just does not change.
Any ideas? Thank you!
mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
ERROR 1142 (42000) at line 1: UPDATE command denied to user ''@'localhost' for table 'user'
Password update failed!
Cleaning up...
Here you go…
To explain how to create a simple script that memorializes your settings or can set up multiple MySQL/MariaDB the same way, setting up security has to be explained
Note that the MySQL/Mariadb root account is different than the system root account, and your error is asking for the latter (system root credentials).
On 02/25/2019 11:46 AM, tsu2 wrote:
>
> Here you go…
> To explain how to create a simple script that memorializes your settings
> or can set up multiple MySQL/MariaDB the same way, setting up security
> has to be explained
> Note that the MySQL/Mariadb root account is different than the system
> root account, and your error is asking for the latter (system root
> credentials).
Don’t you mean the former, MySQL/MariaDB ‘root’ account credentials? The
script’s purpose is to set the database crednetials, and it was
authenticating (per my understanding of the error message) without a
username. Granted, I have not tested this script ever, as I set
credentials directly when setting up a new box.
–
Good luck.
If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below.
If you want to send me a private message, please let me know in the
forum as I do not use the web interface often.
Yes, re-reading the error I read it incorrectly.
Trying to remember when I ran into a similar error long ago, I seem to remember it had to do with the “@localhost” reference in the error. You have to connect to the database using the exactly correct server identification, not an alias like an IP address or hostname.
But, with an Internet search I also see many other possible causes,
You’ll probably have two main options…
Collect all the possible causes and try the fix for each one of them
You can try to reset the MariaDB root password, but if the grant tables don’t already allow access to the MariaDB root account, that won’t help you.
But, with the MariaDB root account you might be able to grant yourself permissions to access… I haven’t done this on a MariaDB/MySQL database, only on a different RDMS so I imagine this should be possible but don’t know off the top of my head how to do it (but should not be easy to find).
On 02/26/2019 03:56 PM, tsu2 wrote:
>
> Trying to remember when I ran into a similar error long ago, I seem to
> remember it had to do with the “@localhost” reference in the error. You
> have to connect to the database using the exactly correct server
> identification, not an alias like an IP address or hostname.
An interesting quirk of MariaDB/MySQL is that credentials are based on
three (3) things rather than two (2), the username, the password, and the
location from which the user originates. With that said, usually
‘root@localhost’ is given all privileges. As a result, I think if the
username can get in there (via that flag I cited) I think it might work.
> But, with the MariaDB root account you might be able to grant yourself
> permissions to access… I haven’t done this on a MariaDB/MySQL
> database, only on a different RDMS so I imagine this should be possible
> but don’t know off the top of my head how to do it (but should not be
> easy to find).
Yes, you can definitely start MariaDB/MySQL in a mode that ignores
privileges, effectively making you a superuser, and then you can grant
rights to root@whatever and restart normally. I believe the option is
–skip-grant-tables so Google for that for more if needed.
–
Good luck.
If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below.
If you want to send me a private message, please let me know in the
forum as I do not use the web interface often.