Hi team, please i need your assistance – I just upgraded from Ubuntu 16.04 to 20.04 - now my application is unable to connect to the mysql database.
I get this error on the frontpage of my website — "Error: Call to a member function getActive() on null: Could not connect to MySQL server"
Then I tried to restore backup - this also resulted in error for mysql backup restore
ERROR 1062 (23000) at line 5530 in file: ‘/tmp/.webmin/169494_25704_1_restore.cgi/martfame.com_mysql_martfame_jmln1’: Duplicate entry ‘’ for key 'uh46v_finder_terms.idx_term’
Operating system:
Ubuntu
OS version:
20.04
Just to provide extra information – this is what I have in mysql.cnf file
The MySQL database server configuration file.
One can use all long options that the program supports.
Run program with --help to get a list of available options and with
–print-defaults to see which it would actually understand and use.
For explanations see
MySQL :: MySQL 8.0 Reference Manual :: 5.1.8 Server System Variables
Here is entries for some specific programs
The following values assume you have at least 32M ram
[mysqld]
* Basic Settings
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
datadir = /var/lib/mysql
If MySQL is running as a replication slave, this should be
changed. Ref MySQL :: MySQL 8.0 Reference Manual :: 5.1.8 Server System Variables
tmpdir = /tmp
Instead of skip-networking the default is now to listen only on
localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1
* Fine Tuning
key_buffer_size = 16M
max_allowed_packet = 512M
thread_stack = 256K
thread_cache_size = -1
This replaces the startup script and checks MyISAM tables if needed
the first time they are touched
myisam-recover-options = BACKUP
max_connections = 151
table_open_cache = 4000
* Logging and Replication
Both location gets rotated by the cronjob.
Log all queries
Be aware that this log type is a performance killer.
general_log_file = /var/log/mysql/query.log
general_log = 1
Error log - should be very few entries.
log_error = /var/log/mysql/error.log
Here you can see queries with especially long duration
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes
The following can be used as easy to replay backup logs or for replication.
note: if you are setting up a replication slave, see README.Debian about
other settings you may need to change.
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
binlog_expire_logs_seconds = 2592000
max_binlog_size = 100M