Mysql – MariaDB won’t start after fresh install. No errors, no logs

debianmariadbMySQL

I just installed MariaDB from the debian repo and I can't start it.

root@Debian9A1:~$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/var/run/mysqld/mysqld.sock' (2)

I tried to launch the service, no success :

root@Debian9A1:/var/log/mysql# systemctl start mariadb
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.

Service status is not useful :

root@Debian9A1:/var/log/mysql# systemctl status mariadb.service
● mariadb.service - MariaDB 10.3.15 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-07-22 16:28:51 CEST; 24s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 3987 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exit

juil. 22 16:28:51 Debian9A1 systemd[1]: Starting MariaDB 10.3.15 database server...
juil. 22 16:28:51 Debian9A1 systemd[1]: mariadb.service: Control process exited, code=exited status
juil. 22 16:28:51 Debian9A1 systemd[1]: Failed to start MariaDB 10.3.15 database server.
juil. 22 16:28:51 Debian9A1 systemd[1]: mariadb.service: Unit entered failed state.
juil. 22 16:28:51 Debian9A1 systemd[1]: mariadb.service: Failed with result 'exit-code'.

Neither is journalctl :

root@Debian9A1:/var/log/mysql# journalctl -xe
[...]
juil. 22 16:28:51 Debian9A1 systemd[1]: Starting MariaDB 10.3.15 database server...
-- Subject: L'unité (unit) mariadb.service a commencé à démarrer
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a commencé à démarrer.
juil. 22 16:28:51 Debian9A1 systemd[1]: mariadb.service: Control process exited, code=exited status=127
juil. 22 16:28:51 Debian9A1 systemd[1]: Failed to start MariaDB 10.3.15 database server.
-- Subject: L'unité (unit) mariadb.service a échoué
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a échoué, avec le résultat failed.
juil. 22 16:28:51 Debian9A1 systemd[1]: mariadb.service: Unit entered failed state.
juil. 22 16:28:51 Debian9A1 systemd[1]: mariadb.service: Failed with result 'exit-code'.

Finally, I don't have anything in the file /var/log/mysql/error.log

Do you have any ideas to help me troubleshoot the problem ? I already tried to reinstall all packages with :

apt-get --purge remove "mysql*"
apt-get --purge remove "mariadb*"

It was not helpful

Best Answer

Please execute:

service mariadb restart; journalctl -xe

So you can ensure no other messages will push mysql/mariadb output outside the view of -xe.

Maybe database never got initialized.

So it might help to know the content of /etc/my.cnf.

let uns know, where datadir is located.

datadir    = /var/lib/mysql

But afaik it changes in some distribution and version to /var/lib/mariadb

If datadir is set and, very important: data dir is empty and database no running:

execute mysql_install_db manually.

** Maybe datadir must be changed.

chown -R mysql:mysql /var/lib/mysql

then try it again:

service mariadb start; journalctl -xe

Maybe use this as initial my.cnf

    # This is default example of MySQL/MariaDB configuration provided with openSUSE package
# It is based on upstream defaults with some additional examples.


# The following options will be passed to all MariaDB clients
[client]
# password  = your_password
# port       = 3306
# socket     = /var/run/mysql/mysql.sock

[xtrabackup]
target_dir = /DATA/BACKUP/mysql
datadir = /var/lib/mysql/

[mysqld]
socket                          = /var/lib/mysql/mysql.sock
innodb_buffer_pool_size         = 20G
innodb_file_format              = Barracuda
innodb_file_per_table           = ON
innodb_buffer_pool_instances    = 20
innodb_thread_concurrency       = 4
innodb_purge_threads            = 4
innodb_strict_mode              = 1
innodb_old_blocks_time          = 1000
innodb_stats_on_metadata        = 0
innodb_write_io_threads         = 4
innodb_read_io_threads          = 4
innodb_io_capacity              = 200000
innodb_open_files               = 10000
innodb_log_file_size            = 1G
innodb_log_buffer_size          = 1G
innodb_log_files_in_group       = 3
transaction-isolation           = READ-COMMITTED


server-id                       = 1
#skip-networking
bind-address                   = 0.0.0.0

log_bin                        = master-mysql-bin
back_log                       = 500
concurrent_insert              = ALWAYS
expire_logs_days               = 10
delay-key-write                = ALL
myisam-recover-options         = FORCE,BACKUP
key_buffer_size                = 512M
join_buffer_size               = 256M
max_allowed_packet             = 128M
max_heap_table_size            = 1024M
tmp_table_size                 = 1024M
thread_stack                   = 192K
table_open_cache               = 10240
table_definition_cache         = 10240
open_files_limit               = 100000
net_retry_count                = 16384
query_cache_type               = 0
query_cache_size               = 0M
query_cache_limit              = 0M
query_cache_min_res_unit       = 1K
thread_cache_size              = 100
max_connections                = 100
ft_max_word_len                = 20
ft_min_word_len                = 3
long_query_time                = 5
local-infile                   = 0
log-warnings                   = 2
performance_schema             = ON
log-slave-updates
log-queries-not-using-indexes
skip-external-locking
skip-symbolic-links
skip-name-resolve

!includedir /etc/my.cnf.d

And then start mysql / mariadb manually:

# To ensure the service is stoppen:
service mariadb stop

/usr/sbin/mysqld --defaults-file=/etc/my.cnf --user=mysql