I'm moving from Centos 7 to Ubuntu 20.04 and installed DA on Ubuntu 20.04
I have domains that have perl .cgi script files that connect to a Maria database with Perl's DBI modules.
When running a perl script that makes a connection to the database, (with DBI) the connection to the database fails with the following:
Cannot connect to MySQL server: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
/var/run/mysqld/mysqld.sock
does not exist but is actually here:
/usr/local/mysql/data/mysql.sock
The only solution to this problem that has worked for me so far was to create a symlink. For example:
/usr/bin/ln -s /usr/local/mysql/data/mysql.sock /var/run/mysqld/mysqld.sock
This works, but if you restart the mysql server or reboot the server the fix is 'no more'. (Not a desirable fix)
I have also tried editing /etc/my.cnf and specified:
socket=/usr/local/mysql/data/mysql.sock
but this has no effect. This is probably because:
/etc/systemd/system/mysqld.service has the following in it:
ExecStart=/usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/mysqld.pid --socket=/usr/local/mysql/data/mysql.sock
If I understand correctly making changes to mysqld.service would not work because DA would overwrite the changes when an update takes place.
Does anybody have a better solution to solving this other than using a symlink?
BTW: phpMyAdmin is working perfectly. It only seems to be Perl's DBI that has this problem of looking for mysqld.sock in the wrong place.
Thanks
I have domains that have perl .cgi script files that connect to a Maria database with Perl's DBI modules.
When running a perl script that makes a connection to the database, (with DBI) the connection to the database fails with the following:
Cannot connect to MySQL server: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
/var/run/mysqld/mysqld.sock
does not exist but is actually here:
/usr/local/mysql/data/mysql.sock
The only solution to this problem that has worked for me so far was to create a symlink. For example:
/usr/bin/ln -s /usr/local/mysql/data/mysql.sock /var/run/mysqld/mysqld.sock
This works, but if you restart the mysql server or reboot the server the fix is 'no more'. (Not a desirable fix)
I have also tried editing /etc/my.cnf and specified:
socket=/usr/local/mysql/data/mysql.sock
but this has no effect. This is probably because:
/etc/systemd/system/mysqld.service has the following in it:
ExecStart=/usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/mysqld.pid --socket=/usr/local/mysql/data/mysql.sock
If I understand correctly making changes to mysqld.service would not work because DA would overwrite the changes when an update takes place.
Does anybody have a better solution to solving this other than using a symlink?
BTW: phpMyAdmin is working perfectly. It only seems to be Perl's DBI that has this problem of looking for mysqld.sock in the wrong place.
Thanks