Installing mariadb104 in iocage (freenas 11.2) via manual does give socket error

Joined
Aug 22, 2020
Messages
13
I wan't to install nextcloud via terminal.
For that I use the supposed way here: Install nextcloud
At one moment, you need a database. In the example another jail with mariadb. I follow the instruction there Install mariadb
Now I have a problem: When I execute
Code:
mysql_secure_installation
in my iocage, I receive an error like
Code:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)

I searched on the place /var/run/mysql.sock for some data. There is none...

Two things:
  1. Maybe my.cnf under /var/db/mysql/my.cnf is not correct. I used the same as suggestet in the manuel.. Should work, or?
  2. I wonder why, no data mysql.sock exists... What can i do to "see" this file?
I looked around the web since yesterday, but I found now solution... Do you have any hints for me?
 

Alecmascot

Guru
Joined
Mar 18, 2014
Messages
1,177
Is mariadb running ?

service mysql-server start
 
Joined
Aug 22, 2020
Messages
13
After installation, I put this two lines into execution
Code:
sysrc mysql_enable=yes
service mysql-server start

This should start mariadb too, right?

If I insert the commant
Code:
mariadb-admin status
in the iocage jail, I recieve following output
Code:
mariadb-admin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists!
 

Alecmascot

Guru
Joined
Mar 18, 2014
Messages
1,177
Joined
Aug 22, 2020
Messages
13
Done. I see the output of
Code:
* Stopping jail
  + Running prestop OK
  + Stopping services OK
  + Tearing down VNET OK
  + Removing devfs_ruleset: 7 OK
  + Removing jail process OK
  + Running poststop OK
* Starting jail
  + Started OK
  + Configuring VNET OK
  + Starting services OK


After that, i enter in the jail enviroment
Code:
iocage console jail

and try
Code:
mysql_secure_installation

same error...
 

Alecmascot

Guru
Joined
Mar 18, 2014
Messages
1,177
Joined
Aug 22, 2020
Messages
13
Ecexute inside the jail the commant
Code:
service mysql-server restart

leads me to the output
Code:
mysql not running? (check /var/db/mysql/jail.pid).
Starting mysql.

After executing
Code:
mysql_secure_installation

same error as befor happend
Code:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)


Thank you for the website. I tried some thirst analysis:
The following commands did not work
Code:
mysqld --help --verbose | grep 'log-error' | tail -1
mysqld --help --verbose | grep 'datadir' | tail -1
mysqld --print-defaults

The error I received was
Code:
mysqld: Command not found.


The following command
Code:
my_print_defaults --mysqld 

give me back something
Code:
--port=3306
--socket=/var/run/mysql/mysql.sock
--user=mysql
--bind-address=127.0.0.1
--basedir=/usr/local
--datadir=/var/db/mysql
--net_retry_count=16384
--log_error=/var/log/mysql/mysqld.err
 

Alecmascot

Guru
Joined
Mar 18, 2014
Messages
1,177
So did you look in /var/log/mysql/mysqld.err ?
Use nano or ee
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
I ran into this issue recently while doing some testing to figure out why my buddies nextcloud install wasn't running. For some reason unknown to me maridb (and mysql) can't create the socket file in /var/run/mysql . Temporarily changing permissions to 777 on that directory and starting mariadb fixed it. After it starts and creates mysql.sock change the permissions back to 755 on /var/run/mysql and you should be all set.
 
Last edited:

Alecmascot

Guru
Joined
Mar 18, 2014
Messages
1,177
Yes it can be permissions
 

Alecmascot

Guru
Joined
Mar 18, 2014
Messages
1,177
with a similar build my error log is
Code:
/var/db/mysql/mariadb.err
 
Joined
Aug 22, 2020
Messages
13
@Alecmascot: not yet, thanks for the hint. I have a look on it. I see many items there...

@Jailer: Thank you very much!! This seems to solve my issue. 775 means more rights for the group... Before that Do you see some security issues for that?

Do you know, if this items is known and will be fixed in 11.3 enviroment?
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
@Alecmascot: not yet, thanks for the hint. I have a look on it. I see many items there...

@Jailer: Thank you very much!! This seems to solve my issue. 775 means more rights for the group... Before that Do you see some security issues for that?

Do you know, if this items is known and will be fixed in 11.3 enviroment?
Sorry, I miss typed that. It should be 755. I'll change my original post in case someone runs across this in the future.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Top