LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-09-2019, 07:29 PM   #1
PCManiacpt
LQ Newbie
 
Registered: Sep 2008
Posts: 17

Rep: Reputation: 0
MariaDB does not store/request root password


Greetings,

Been fiddling and trying to understand what is going on with MariaDB installation.
After countless reinstalls, after stumbling with the problem described here (about PAM) and bypassing it the same way it got suggested in the post, I noticed that I would not be able to login as root through any MariaDB client (be it with PHP scripts or stand alone clients).

Further investigation went by and noticed that, and here lies the problem, after the mysql_install_db, even if you set the root password, it will never work correctly (As in, mysql does not care a thing about it).

I have faced this problem in recently installed (current) computers and VMs, be it 64 or even (just now) 32 bit releases.

Does anyone know what to do next to change its behaviour and fix it (or corretly use it)?

Example of what I tried to explain: https://imgur.com/a/pcnms0j

Best regards.
 
Old 07-10-2019, 12:41 AM   #2
Labinnah
Member
 
Registered: May 2014
Location: Łódź, Poland
Distribution: Slackware-current
Posts: 81

Rep: Reputation: 38
If you manually set privileges you must run this SQL query to make it work in currently running server:
Code:
flush privileges
But if you want secure mariadb by running shell command this is the right one:
Code:
mysql_secure_installation
 
1 members found this post helpful.
Old 07-10-2019, 04:18 AM   #3
PCManiacpt
LQ Newbie
 
Registered: Sep 2008
Posts: 17

Original Poster
Rep: Reputation: 0
Thank you for your reply Labinnah.

I did write the wrong command over here (copy/pasted but did not notice there were 2 similar commands).
I just tried again, and here is the full log.

Code:
root@SlackWebTeste:/home/joao# 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
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] 
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] 
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] 
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] 
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] 
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
root@SlackWebTeste:/home/joao# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 90
Server version: 10.4.6-MariaDB MariaDB Server

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)]>
 
Old 07-10-2019, 05:19 AM   #4
Labinnah
Member
 
Registered: May 2014
Location: Łódź, Poland
Distribution: Slackware-current
Posts: 81

Rep: Reputation: 38
I suspect that problem is in changing password filed in mysql.user table. Since Mariadb 10.4 default in "authentication_string" not "password". Probably some tool and libraries choose different fields and this are the results. Try run:
Code:
mysql_upgrade
It may cleanup mysql tables and fix your problem.
 
1 members found this post helpful.
Old 07-10-2019, 05:54 AM   #5
PCManiacpt
LQ Newbie
 
Registered: Sep 2008
Posts: 17

Original Poster
Rep: Reputation: 0
@Labinnah did try it, same stuff. :\

Code:
root@SlackWebTeste:/home/joao# mysql_upgrade 
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.global_priv                                  OK
mysql.gtid_slave_pos                               OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.index_stats                                  OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.roles_mapping                                OK
mysql.servers                                      OK
mysql.table_stats                                  OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.transaction_registry                         OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
mysql.user                                         OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
ocsreport
ocsreport.ORACLE                                   OK
ocsreport.accesslog                                OK
ocsreport.accountinfo                              OK
ocsreport.accountinfo_config                       OK
ocsreport.assets_categories                        OK
ocsreport.batteries                                OK
ocsreport.bios                                     OK
ocsreport.bitlockerstatus                          OK
ocsreport.blacklist_macaddresses                   OK
ocsreport.blacklist_serials                        OK
ocsreport.blacklist_subnet                         OK
ocsreport.checkfiles                               OK
ocsreport.config                                   OK
ocsreport.conntrack                                OK
ocsreport.controllers                              OK
ocsreport.cpus                                     OK
ocsreport.customapp                                OK
ocsreport.cve_search                               OK
ocsreport.dbinstances                              OK
ocsreport.deleted_equiv                            OK
ocsreport.deploy                                   OK
ocsreport.devices                                  OK
ocsreport.devicetype                               OK
ocsreport.dico_ignored                             OK
ocsreport.dico_soft                                OK
ocsreport.download_affect_rules                    OK
ocsreport.download_available                       OK
ocsreport.download_enable                          OK
ocsreport.download_history                         OK
ocsreport.download_servers                         OK
ocsreport.downloadwk_conf_values                   OK
ocsreport.downloadwk_fields                        OK
ocsreport.downloadwk_history                       OK
ocsreport.downloadwk_pack                          OK
ocsreport.downloadwk_statut_request                OK
ocsreport.downloadwk_tab_values                    OK
ocsreport.driverslist                              OK
ocsreport.drives                                   OK
ocsreport.engine_mutex                             OK
ocsreport.engine_persistent                        OK
ocsreport.extensions                               OK
ocsreport.files                                    OK
ocsreport.groups                                   OK
ocsreport.groups_cache                             OK
ocsreport.hardware                                 OK
ocsreport.hardware_osname_cache                    OK
ocsreport.hpdisk                                   OK
ocsreport.hpmgmt                                   OK
ocsreport.hpraid                                   OK
ocsreport.hpsmart                                  OK
ocsreport.iesettings                               OK
ocsreport.inputs                                   OK
ocsreport.itmgmt_comments                          OK
ocsreport.javainfo                                 OK
ocsreport.journallog                               OK
ocsreport.languages                                OK
ocsreport.listprinters                             OK
ocsreport.locks                                    OK
ocsreport.memories                                 OK
ocsreport.modems                                   OK
ocsreport.monitors                                 OK
ocsreport.navigatorproxysetting                    OK
ocsreport.netmap                                   OK
ocsreport.network_devices                          OK
ocsreport.networks                                 OK
ocsreport.networkshare                             OK
ocsreport.notification                             OK
ocsreport.notification_config                      OK
ocsreport.officepack                               OK
ocsreport.operators                                OK
ocsreport.osinstall                                OK
ocsreport.pluginslist                              OK
ocsreport.ports                                    OK
ocsreport.printers                                 OK
ocsreport.prolog_conntrack                         OK
ocsreport.regconfig                                OK
ocsreport.registry                                 OK
ocsreport.registry_name_cache                      OK
ocsreport.registry_regvalue_cache                  OK
ocsreport.repository                               OK
ocsreport.saas                                     OK
ocsreport.saas_exp                                 OK
ocsreport.schedule_WOL                             OK
ocsreport.scheduledtasks                           OK
ocsreport.securitycenter                           OK
ocsreport.service                                  OK
ocsreport.sharedfolders                            OK
ocsreport.sim                                      OK
ocsreport.slots                                    OK
ocsreport.snmp                                     OK
ocsreport.snmp_accountinfo                         OK
ocsreport.snmp_blades                              OK
ocsreport.snmp_cards                               OK
ocsreport.snmp_cartridges                          OK
ocsreport.snmp_communities                         OK
ocsreport.snmp_computers                           OK
ocsreport.snmp_cpus                                OK
ocsreport.snmp_drives                              OK
ocsreport.snmp_fans                                OK
ocsreport.snmp_firewalls                           OK
ocsreport.snmp_inputs                              OK
ocsreport.snmp_laststate                           OK
ocsreport.snmp_loadbalancers                       OK
ocsreport.snmp_localprinters                       OK
ocsreport.snmp_memories                            OK
ocsreport.snmp_mibs                                OK
ocsreport.snmp_modems                              OK
ocsreport.snmp_networks                            OK
ocsreport.snmp_ports                               OK
ocsreport.snmp_powersupplies                       OK
ocsreport.snmp_printers                            OK
ocsreport.snmp_softwares                           OK
ocsreport.snmp_sounds                              OK
ocsreport.snmp_storages                            OK
ocsreport.snmp_switchinfos                         OK
ocsreport.snmp_switchs                             OK
ocsreport.snmp_trays                               OK
ocsreport.snmp_videos                              OK
ocsreport.snmp_virtualmachines                     OK
ocsreport.software_categories                      OK
ocsreport.software_category_exp                    OK
ocsreport.softwares                                OK
ocsreport.softwares_name_cache                     OK
ocsreport.sounds                                   OK
ocsreport.ssl_store                                OK
ocsreport.storages                                 OK
ocsreport.subnet                                   OK
ocsreport.tags                                     OK
ocsreport.teamviewer                               OK
ocsreport.temp_files                               OK
ocsreport.uptime                                   OK
ocsreport.usbdevices                               OK
ocsreport.videos                                   OK
ocsreport.virtualmachines                          OK
ocsreport.winupdatestate                           OK
ocsreport.winusers                                 OK
performance_schema
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
root@SlackWebTeste:/home/joao# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 193
Server version: 10.4.6-MariaDB MariaDB Server

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)]>
 
Old 07-10-2019, 06:08 AM   #6
Labinnah
Member
 
Registered: May 2014
Location: Łódź, Poland
Distribution: Slackware-current
Posts: 81

Rep: Reputation: 38
My ideas almost ends

Try this queries:
Code:
use mysql;
select host,user,password,plugin,authentication_string from user;
Verify if host is properly set and password hashes are same in password and authentication_string (don't show output here, if you have "real" passwords). If not, fix it, and flush privileges.

If still not helps, just try restart db.
 
1 members found this post helpful.
Old 07-10-2019, 07:20 AM   #7
PCManiacpt
LQ Newbie
 
Registered: Sep 2008
Posts: 17

Original Poster
Rep: Reputation: 0
Code:
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> select host,user,password,plugin,authentication_string from user;
+-----------+-------------+-------------------------------------------+-----------------------+-------------------------------------------+
| Host      | User        | Password                                  | plugin                | authentication_string                     |
+-----------+-------------+-------------------------------------------+-----------------------+-------------------------------------------+
| localhost | root        | *redacted                                 | mysql_native_password | *redacted                                 |
| localhost | mysql       | invalid                                   | mysql_native_password | invalid                                   |
+-----------+-------------+-------------------------------------------+-----------------------+-------------------------------------------+
It does show the same.
I have done all those steps on a clean DB before and still the same outcome.

Thank you for your input, lets see if any other ideas arise.
 
Old 07-10-2019, 07:31 AM   #8
Labinnah
Member
 
Registered: May 2014
Location: Łódź, Poland
Distribution: Slackware-current
Posts: 81

Rep: Reputation: 38
I have one more idea. You can use "skip-grant-tables" option somewhere in configs or commandline. But I'm sure you will remember using it, as it disable authentication at all...
 
1 members found this post helpful.
Old 07-11-2019, 03:03 AM   #9
PCManiacpt
LQ Newbie
 
Registered: Sep 2008
Posts: 17

Original Poster
Rep: Reputation: 0
Labinnah,

Did check it and no, do not have it anywhere.
 
Old 07-11-2019, 03:45 AM   #10
ppr:kut
Slackware Contributor
 
Registered: Aug 2006
Location: Netherlands
Distribution: Slackware
Posts: 519

Rep: Reputation: 315Reputation: 315Reputation: 315Reputation: 315
MariaDB 10.4 changed how authentication works, especially root user authentication out-of-the-box.
Check here for details: https://mariadb.com/kb/en/library/au...m-mariadb-104/
 
2 members found this post helpful.
Old 07-11-2019, 04:31 AM   #11
PCManiacpt
LQ Newbie
 
Registered: Sep 2008
Posts: 17

Original Poster
Rep: Reputation: 0
Double posted

Last edited by PCManiacpt; 07-11-2019 at 11:03 AM.
 
Old 07-11-2019, 04:33 AM   #12
PCManiacpt
LQ Newbie
 
Registered: Sep 2008
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ppr:kut View Post
MariaDB 10.4 changed how authentication works, especially root user authentication out-of-the-box.
Check here for details: https://mariadb.com/kb/en/library/au...m-mariadb-104/
oh?! ooooooooh!.. duh!
Ok, that does explain a lot indeed.

Thank you very much. Did try it and it did work as advertised.

I apologize for not reading the mariadb info.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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: 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
OCS Inventory -- Problem after changing mariadb root password... Help me plesase renegateqq Linux - Software 1 05-03-2017 08:31 AM
LXer: How to reset a root password in MariaDB on Linux LXer Syndicated Linux News 0 06-18-2014 02:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:03 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration