[MDEV-13133] Broken yum install on RHEL 7 Created: 2017-06-20  Updated: 2017-06-21  Resolved: 2017-06-21

Status: Closed
Project: MariaDB Server
Component/s: Platform RedHat
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Marco Liceti Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None


 Description   

Hi, I (tried to) install MariaDB using these instructions:

https://mariadb.com/kb/en/mariadb/yum/

The installation succeeds, but I'm locked out, i.e. can't connect as root. A comment on the same page says that the root password is blank, but that's not true.



 Comments   
Comment by Elena Stepanova [ 2017-06-20 ]

Have you started the server after installation? If it wasn't installed and running before, it won't start on its own.

If you have, then please

  • specify the version you are installing;
  • paste the output of rpm -qa | grep -E 'maria|mysql' prior to installation;
  • paste the output of /ls /etc/my* /var/lib/mysql/ *prior to installation;
  • paste or attach the unabridged output of the installation process;
  • paste the console output of your attempt to connect to the server after starting it.

You can obfuscate any data that is confidential, but please don't remove anything.
If you still find it too confidential to paste in the public JIRA, you can upload it to ftp.askmonty.org/private.

Comment by Marco Liceti [ 2017-06-21 ]

Hi, Elena.

Of course I started the server.

As for the version that I'm installing, it should be the one referenced by the page I linked previously.

More precisely, this is the content of /etc/yum.repos.d/MariaDB.repo:

# MariaDB 10.2 RedHat repository list - created 2017-06-20 10:35 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/rhel7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

The output of rpm -qa | grep -E 'maria|mysql' is blank.

The output of ls /etc/my* /var/lib/mysql is:

[root@stad-ui-notaio ~]# ls /etc/my* /var/lib/mysql
/etc/my.cnf
 
/var/lib/mysql:
aria_log.00000001  client-cert.pem  ib_logfile1         public_key.pem
aria_log_control   client-key.pem   multi-master.info   server-cert.pem
auto.cnf           ib_buffer_pool   mysql               server-key.pem
ca-key.pem         ibdata1          performance_schema  stad-ui-notaio.err
ca.pem             ib_logfile0      private_key.pem     sys

Here is the output of the install process:

[root@stad-ui-notaio ~]# yum install MariaDB-server MariaDB-client
Plugin abilitati:langpacks
epel/x86_64/metalink                                     |  25 kB     00:00     
epel                                                     | 4.3 kB     00:00     
mariadb                                                  | 2.9 kB     00:00     
mongodb-org-2.6                                          |  951 B     00:00     
nodesource                                               | 2.5 kB     00:00     
ol7_UEKR3                                                | 1.2 kB     00:00     
ol7_latest                                               | 1.4 kB     00:00     
Risoluzione dipendenze
--> Esecuzione del controllo di transazione
---> Pacchetto MariaDB-client.x86_64 0:10.2.6-1.el7.centos settato per essere installato
---> Pacchetto MariaDB-server.x86_64 0:10.2.6-1.el7.centos settato per essere installato
--> Risoluzione delle dipendenze completata
 
Dipendenze risolte
 
================================================================================
 Package             Arch        Versione                    Repository    Dim.
================================================================================
Installazione:
 MariaDB-client      x86_64      10.2.6-1.el7.centos         mariadb       48 M
 MariaDB-server      x86_64      10.2.6-1.el7.centos         mariadb      108 M
 
Riepilogo della transazione
================================================================================
Install  2 Pacchetto
 
Dimensione totale del download: 156 M
Dimensione installata: 660 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): MariaDB-10.2.6-centos7-x86_64-client.rpm            |  48 MB   01:32     
(2/2): MariaDB-10.2.6-centos7-x86_64-server.rpm            | 108 MB   02:59     
--------------------------------------------------------------------------------
Totale                                             889 kB/s | 156 MB  02:59     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installazione     : MariaDB-client-10.2.6-1.el7.centos.x86_64             1/2 
  Installazione     : MariaDB-server-10.2.6-1.el7.centos.x86_64             2/2 
  Verifica in corso : MariaDB-server-10.2.6-1.el7.centos.x86_64             1/2 
  Verifica in corso : MariaDB-client-10.2.6-1.el7.centos.x86_64             2/2 
 
Installato:
  MariaDB-client.x86_64 0:10.2.6-1.el7.centos                                   
  MariaDB-server.x86_64 0:10.2.6-1.el7.centos                                   
 
Completo!

Then I start the service:

[root@stad-ui-notaio ~]# systemctl start mariadb

There is no output. But I think this means that the service started up correctly.

This is the output I get when I try to connect:

[root@stad-ui-notaio ~]# mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Just to be sure that the server is running, I stopped and retried to connect:

[root@stad-ui-notaio ~]# mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

As you can see, the output is changed.

Comment by Elena Stepanova [ 2017-06-21 ]

marcoliceti,

Thanks for this, it's quite clear now.

The comment on that page isn't wrong, it just assumes a new clean installation.

As you can see, even though there are no MySQL/MariaDB packages on your machine at the moment, there had been some MariaDB before, that's why you still have /var/lib/mysql. Among other things, it contains authentication information – users, passwords and such. When MariaDB is installed over already existing datadir, it doesn't clean it of course, it assumes that if a user kept it, it was for a reason (which is a very common scenario when you upgrade to a higher major version on RPM-based systems – you remove the old version first, and then install a new one, but of course you want to preserve the data).

So, if you want a really clean installation and there is nothing important for you in /var/lib/mysql, you need to remove it before installation.

You can uninstall/clean/install again (in addition to cleaning the datadir, it might make sense to check that you don't have stale config files in /etc/my.cnf and /etc/mysql/.... Or, if the password is the only problem, you can keep the current installation, start the server with skip-grant-tables, reset the password(s) and run FLUSH PRIVILEGES.

Comment by Marco Liceti [ 2017-06-21 ]

You're right. Apparently I was working on a dirty machine, I'm sorry.

I deleted /var/lib/mysql and /etc/my.cnf, then I reinstalled from scratch. I confirm that now it's possible to connect as root with a blank password

Generated at Thu Feb 08 08:03:09 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.