Database fails to initialize 2
-
@Tom-Elliott But, did we not have a mess with Ubuntu on this very issue before, and you chose to use 127.0.0.1 because of it?
I’d ask to only set it as
localhost
for Mangeia 5.I’ll test this setting also with Ubuntu 16 as it suffers from the DB not being created.
-
@Tom-Elliott said:
but why isn’t the default allowing creation of the root user to BOTH addresses?
Mysql does not automatically allow access to the reverse lookup of a hostname or vice versa. Even full qualified vs. short hostname might cause trouble. This is just the way mysql does things. You might want to look into adding both localhost and 127.0.0.1 but then there is the mess of keeping the passwords in sync.
-
@Sebastian-Roth The issue, as I’m seeing it, is somewhere there was a change. Maybe this 127.0.0.1 vs. localhost change (I don’t care, at this point, for FQDN vs. short hostname) happened in a different version of mysql? I’ve never seen an issue using 127.0.0.1 or localhost on mysql, until now.
In either case, using localhost shouldn’t pose an issue, and the only reason, as I stated earlier, that I started using tcp vs. socket was solely for persistent connections. Mind you this was still when I was using mysqli as the method of managing connections to the DB and I now use PDO which might have some better handling for this type of thing.
-
@Tom-Elliott What I mean is explained here: http://serverfault.com/questions/544187/cant-connect-to-mysql-using-localhost-but-using-127-0-0-1-its-ok
mysql> select user,host from mysql.user; +------+--------------------------------+ | user | host | +------+--------------------------------+ | root | 127.0.0.1 | | root | ::1 | | root | localhost | +------+--------------------------------+ 3 rows in set (0.00 sec)
As you can see there are different entries for the same user but different host entries in the mysql user table.
-
@Sebastian-Roth I understand, just I’m used to them all being ready to use at the same time when the initial installation occurs.
-
@Tom-Elliott I think I’ve found the explanation for this behavior. It’s controlled by an option in the mysql configuration /etc/my.cnf. The option is controlled by the variable skip-network which on the MariaDB on Mageia 5 and Ubuntu 16 is enabled. Apparently this is a security enhancement. If the skip-network line is remarked out in /etc/my.cnf Fog has no problems with 127.0.0.1 (or ::1 ip6 for that matter).
It raises the question of how FOG should handle this. As newer security conscious distros come out, I suspect this will come up more and more.
-
@syschuck I’ve updated the installer to default to localhost as a “safety” of course you can still set your own host after, or inline with the installer.
I believe the variable is:
snmysqlhost='127.0.0.1'
Of course you can run the installer as:
snmysqlhost='localhost' ./installfog.sh -y
-
@Tom-Elliott Hi Tom, here is a code fragment that will check /etc/my.cnf for the skip-networking flag and set ${snmysqlhost} appropriately. It may not always get it but I think my.cnf is pretty standard for mysql and MariaDB.
#!/bin/sh mysqlcfg=/etc/my.cnf snmysqlhost='127.0.0.1' if [ -f ${mysqlcfg} ]; then W=`grep skip-networking ${mysqlcfg} | sed "/^\s*\;/d;s/\s*\;[^\"']*$//" | sed "/^\s*#/d;s/\s*#[^\"']*$//"` if [ ! -z $W ]; then snmysqlhost='localhost' fi fi echo ${snmysqlhost} # ./installfog.sh -y
Tom, I think you can mark this one as solved.
-
@syschuck Because I always default to localhost, I think this can also be solved, however your issue brings up another potential downfall in that your patch only changes to snmysqlhost to localhost if skip-networking is on. However, if skip-networking is on, Storage Nodes won’t be able to communicate to the DB because we’ve essentially disabled networking access.
I propose this:
for mysqlconf in $(grep -rl '.*skip-networking' /etc); do sed -i '/.*skip-networking/ s/^#*/#/' -i $mysqlconf >>$workingdir/error_logs/fog_error_${version}.log 2>&1 done
This method, I think, is better in that I only comment the skip networking lines in any found mysql conf files (as I’m not aware of other configs having the skip-networking as a config). It means I don’t guess which files to edit as the return will only give us matching files.
I already do something similar to this for bind-address (at least for ARCH and have moved them both to happen on any system.
Hopefully this makes sense.
-
@Tom-Elliott That makes sense. I think there is also a /etc/my.cnf.d under ubuntu and mageia that skip-networking could be hidden under. So seems reasonable. Be aware, my.cnf has two comment characters, ‘#’ and ‘;’. That’s why my sed thing was so contorted.
-
@syschuck But I can guarantee the comment is done with a ‘#’ anyway.
Unless the files are not interchangable.