LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-29-2020, 12:53 AM   #1
FrederikSchack
LQ Newbie
 
Registered: Apr 2020
Posts: 18

Rep: Reputation: Disabled
Can't change blank root password for MariaDB


Hi,

I have a new install of OpenSUSE and I'm a newbie in Linux.

It comes with a pre-installed MariaDB, which doesn't have a root password. So I can login with 'root' and no password.

I tried to set it with:
SET PASSWORD FOR 'root' = PASSWORD('password');

But get:
ERROR 1133 (28000): Can't find any matching row in user table.

When searching online, there are many possible issues and the solutions I've tried doesn't work.

Anybody who has any clues?

Last edited by FrederikSchack; 04-29-2020 at 12:54 AM.
 
Old 04-29-2020, 01:29 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,864

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
https://linuxize.com/post/how-to-res...root-password/
If this does not help please explain what did you try exactly and what's happened.
 
Old 04-29-2020, 03:16 AM   #3
FrederikSchack
LQ Newbie
 
Registered: Apr 2020
Posts: 18

Original Poster
Rep: Reputation: Disabled
Hi Pan64,

Thanks for your feedback.

------
Even though I can login without a password at the root, I also took the first steps;

linux-jfw1:~ # mysql --version
mysql Ver 15.1 Distrib 10.2.31-MariaDB, for Linux (x86_64) using EditLine wrapper
linux-jfw1:~ # systemctl stop mysql
linux-jfw1:~ # mysqld_safe --skip-grant-tables &
[1] 7213
linux-jfw1:~ # 200429 04:48:25 mysqld_safe Logging to '/var/log/mysql/mysqld.log'.
200429 04:48:25 mysqld_safe A mysqld process already exists

------

The first option didn't work out because of the --skip-grant-tables option:

FGS@linux-jfw1:~> mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.2.31-MariaDB SUSE package

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED BY 'something'
-> ;
ERROR 1290 (HY000): The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
MariaDB [(none)]> Ctrl-C -- exit!
Aborted
FGS@linux-jfw1:~>


------
The second option I tried and accidentially overwrote 6 passwords??? Although there are basically no tables in the database, are there any applications using the database in standard OpenSUSE? Afterwards it denied access with the added password, but accepted no password.

FGS@linux-jfw1:~> mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.2.31-MariaDB SUSE package

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> UPDATE mysql.user SET authentication_string = PASSWORD('something')
-> ;
Query OK, 6 rows affected (0.00 sec)
Rows matched: 6 Changed: 6 Warnings: 0

MariaDB [(none)]> WHERE User = 'root' AND Host = 'localhost';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE User = 'root' AND Host = 'localhost'' at line 1
MariaDB [(none)]> WHERE user = 'root' AND Host = 'localhost';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE user = 'root' AND Host = 'localhost'' at line 1
MariaDB [(none)]> UPDATE mysql.user SET authentication_string = PASSWORD('something')
-> WHERE user = 'root' and Host = 'localhost';
Query OK, 0 rows affected (0.01 sec)
Rows matched: 1 Changed: 0 Warnings: 0

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> exit
Bye
FGS@linux-jfw1:~> mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
FGS@linux-jfw1:~> mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.2.31-MariaDB SUSE package

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>



I'm mostly used with Windows and graphical userinterfaces, so bear with me -
 
Old 04-29-2020, 03:52 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,864

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
would be nice to use code tags.
Yes it looks like you have set the password and not only for root, but for every user.
Code:
# you must not split it into two lines:
MariaDB [(none)]> UPDATE mysql.user SET authentication_string = PASSWORD('something')
MariaDB [(none)]> WHERE User = 'root' AND Host = 'localhost';
# the correct way would have been:
MariaDB [(none)]> UPDATE mysql.user SET authentication_string = PASSWORD('something') WHERE User = 'root' AND Host = 'localhost';
So how to go further?
 
  


Reply

Tags
mariadb, mysql, opensuse, passwd, pre-installed



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Three Ways To Change User’s MySQL/MariaDB Password in Linux LXer Syndicated Linux News 0 06-10-2019 10:21 PM
LXer: KDE Participating in Google Summer of Code 2019, MariaDB Releasing New Open-Source MariaDB Enterprise Server, CentOS Celebrates 15th B LXer Syndicated Linux News 0 02-28-2019 06:50 AM
[SOLVED] mysql/mariadb install root password not working j-ray Linux - Software 4 09-19-2018 02:54 PM
LXer: How to reset a root password in MariaDB on Linux LXer Syndicated Linux News 0 06-18-2014 02:51 AM
How could normal user obtain root password or change root password ckamheng Debian 18 02-18-2009 10:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration