Bug 246837 - databases/mariadb104-server 10.4.13_2: mysql_secure_installation ignores my.cnf
Summary: databases/mariadb104-server 10.4.13_2: mysql_secure_installation ignores my.cnf
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Bernard Spil
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-29 12:32 UTC by oz42
Modified: 2020-05-31 16:01 UTC (History)
1 user (show)

See Also:
linimon: maintainer-feedback? (brnrd)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description oz42 2020-05-29 12:32:22 UTC
My freshly installed mysqld from ports starts just fine:

2020-05-29 14:26:11 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-05-29 14:26:11 0 [Note] Reading of all Master_info entries succeeded
2020-05-29 14:26:11 0 [Note] Added new Master_info '' to hash table
2020-05-29 14:26:11 0 [Note] /usr/local/libexec/mysqld: ready for connections.
Version: '10.4.13-MariaDB'  socket: '/var/run/mysql/mysql.sock'  port: 3306  FreeBSD Ports

But mysql_secure_installation ignores the settings from
/usr/local/etc/mysql/my.cnf:


# 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):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)


/usr/local/etc/mysql/my.cnf was created by 'make install' and not changed.
Comment 1 Bernard Spil freebsd_committer 2020-05-31 13:13:11 UTC
Hi,

Was this with version 10.4.13_1? That is an issue with the port.

Can you verify that you now run 10.4.13_2 and the issue is gone?
Comment 2 oz42 2020-05-31 14:38:41 UTC
Other way round: _1 worked just fine without any problem, _2 even fails to start mysqld with the rc.d script, so I have started it manually on the command line somehow.

IMHO _2 has introduced some bugs that makes it practically non-functional.

I did a fresh install on a new box to make sure that this has nothing to do with my setup. This bug and the "not starting" bug is here too.

Right now, my Nextcloud box is offline. Ist it possible to downgrade to mariadb103-server?
Comment 3 Bernard Spil freebsd_committer 2020-05-31 15:47:46 UTC
The error you're seeing is with the moved location of the socket.

I think the error is here in mysql_secure install
> 217 do_query() {
> 218     echo "$1" >$command
> 219     #sed 's,^,> ,' < $command  # Debugging
> 220     $mysql_command --defaults-file=$config $defaults_extra_file $no_defaults $args <$command >$output
> 221     return $?
> 222 }

This _will_ give you grief. It is clobbering any config that is set in your my.cnf and demands the socket to be in the default location.

So... Comment out the `socket` line in mysql/conf.d/client.cnf and try again. Restart DB, then run mariadb-secure-installation.

Nasty side-effects of the recent changes! This secure-installation change needs changing!
Comment 4 Bernard Spil freebsd_committer 2020-05-31 16:01:00 UTC
FWIW... Your statement seems correct. That script DOES ignore all config.
Seems intentional... Open an issue on their JIRA, and drop a link here, I will chime in and try to get this to change!