Why can't I start MariaDB? - mariadb

Arch Linux, standard kernel 5.16.3, MariaDB v10.6.5.
I try to start MariaDB, and it fails with
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (111)
systemctl status mariadb gives me
Jan 28 20:13:13 gazelle mariadbd[2915]: 2022-01-28 20:13:13 0 [Note] InnoDB: Buffer pool(s) load completed at 220128 20:13:13
Jan 28 20:13:13 gazelle mariadbd[2915]: 2022-01-28 20:13:13 0 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
Jan 28 20:13:13 gazelle mariadbd[2915]: 2022-01-28 20:13:13 0 [Note] Server socket created on IP: '0.0.0.0'.
Jan 28 20:13:13 gazelle mariadbd[2915]: 2022-01-28 20:13:13 0 [Note] Server socket created on IP: '::'.
Jan 28 20:13:13 gazelle mariadbd[2915]: 2022-01-28 20:13:13 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.db' doesn't exist
Jan 28 20:13:13 gazelle mariadbd[2915]: 2022-01-28 20:13:13 0 [ERROR] Aborting
Jan 28 20:13:13 gazelle mariadbd[2915]: Warning: Memory not freed: 280
Jan 28 20:13:13 gazelle systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jan 28 20:13:13 gazelle systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jan 28 20:13:13 gazelle systemd[1]: Failed to start MariaDB 10.6.5 database server.
So okay, I can't connect because the server isn't starting up. But even when it did start --- it did start on a few occasions, I would still get this error. I looked in /run/mysqld, and mysqld.sock is there, with 777 permissions, and it's owned by the mysql user. I've also made sure that /var/lib/mysql and everything underneath it is owned by mysql
Here's /etc/my.cnf
#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
[mysqld]
socket = /run/mysqld/mysqld.sock
[client]
socket = /run/mysqld/mysqld.sock
#
# include *.cnf from the config directory
#
!includedir /etc/my.cnf.d
What are the next possible steps? I've scoured the 'net, and nothing seems to help.

When initializing the database, mysql_install_db Whether the datadir directory is specified during dB. It is recommended to use my.cnf Specify the datadir directory in the CNF configuration file

Okay, so Paul T's comment
Curious about the two missing tables causing errors. Did the install not go smoothly, maybe reinstall?
was the clue. Looked at the MariaDB page on the Arch wiki, and I forgot to run mariadb-install-db. Should've RTFM.

Related

mariadb won't start suddenly

I have some trouble with my MariaDB Server, it was working ok but it won't start anymore. When I try to start the server it failed:
root#vps45223599:/var/log# /etc/init.d/mysql start
[....] Starting mysql (via systemctl): mysql.serviceJob for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
failed!
root#vps45223599:/var/log# systemctl status mariadb.service
● mariadb.service - MariaDB 10.1.41 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2023-01-10 21:20:58 UTC; 1min 15s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 1349 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 1274 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR
Process: 1272 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 1271 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 1349 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"
Jan 10 21:20:55 vps45223599.local systemd[1]: Starting MariaDB 10.1.41 database server...
Jan 10 21:20:55 vps45223599.local mysqld[1349]: 2023-01-10 21:20:55 140599894461824 [Note] /usr/sbin/mysqld (mysqld 10.1.41-MariaDB-0+deb9u1) starting as process 1349 ...
Jan 10 21:20:58 vps45223599.local systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jan 10 21:20:58 vps45223599.local systemd[1]: Failed to start MariaDB 10.1.41 database server.
Jan 10 21:20:58 vps45223599.local systemd[1]: mariadb.service: Unit entered failed state.
Jan 10 21:20:58 vps45223599.local systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jan 10 21:15:43 vps45223599.local systemd[1]: Failed to start MariaDB 10.1.41 database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit mariadb.service has failed.
--
-- The result is failed.
Jan 10 21:15:43 vps45223599.local systemd[1]: mariadb.service: Unit entered failed state.
Jan 10 21:15:43 vps45223599.local systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jan 10 21:15:43 vps45223599.local sudo[1040]: pam_unix(sudo:session): session closed for user root
Jan 10 21:15:50 vps45223599.local sudo[1146]: root : TTY=pts/1 ; PWD=/var/log ; USER=root ; COMMAND=/bin/systemctl start mariadb
Jan 10 21:15:50 vps45223599.local sudo[1146]: pam_unix(sudo:session): session opened for user root by cbarca(uid=0)
Jan 10 21:15:50 vps45223599.local systemd[1]: Failed to set devices.allow on /system.slice/mariadb.service: Operation not permitted
Jan 10 21:15:50 vps45223599.local systemd[1]: Failed to set devices.allow on /system.slice/mariadb.service: Operation not permitted
Jan 10 21:15:50 vps45223599.local systemd[1]: Starting MariaDB 10.1.41 database server...
-- Subject: Unit mariadb.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit mariadb.service has begun starting up.
Jan 10 21:15:51 vps45223599.local mysqld[1227]: 2023-01-10 21:15:51 139968422329728 [Note] /usr/sbin/mysqld (mysqld 10.1.41-MariaDB-0+deb9u1) starting as process 1227 ...
Jan 10 21:15:54 vps45223599.local systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jan 10 21:15:54 vps45223599.local systemd[1]: Failed to start MariaDB 10.1.41 database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit mariadb.service has failed.
--
-- The result is failed.
Jan 10 21:15:54 vps45223599.local systemd[1]: mariadb.service: Unit entered failed state.
Jan 10 21:15:54 vps45223599.local systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jan 10 21:15:54 vps45223599.local sudo[1146]: pam_unix(sudo:session): session closed for user root
Jan 10 21:20:55 vps45223599.local systemd[1]: Failed to set devices.allow on /system.slice/mariadb.service: Operation not permitted
Jan 10 21:20:55 vps45223599.local systemd[1]: Failed to set devices.allow on /system.slice/mariadb.service: Operation not permitted
Jan 10 21:20:55 vps45223599.local systemd[1]: Starting MariaDB 10.1.41 database server...
-- Subject: Unit mariadb.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit mariadb.service has begun starting up.
Jan 10 21:20:55 vps45223599.local mysqld[1349]: 2023-01-10 21:20:55 140599894461824 [Note] /usr/sbin/mysqld (mysqld 10.1.41-MariaDB-0+deb9u1) starting as process 1349 ...
Jan 10 21:20:58 vps45223599.local systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jan 10 21:20:58 vps45223599.local systemd[1]: Failed to start MariaDB 10.1.41 database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit mariadb.service has failed.
--
-- The result is failed.
Jan 10 21:20:58 vps45223599.local systemd[1]: mariadb.service: Unit entered failed state.
Jan 10 21:20:58 vps45223599.local systemd[1]: mariadb.service: Failed with result 'exit-code'.
I don't know what happened. I also try
mysqlcheck
root#vps45223599:/var/log# mysqlcheck --all-databases -p
Enter password:
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory") when trying to connect
I don't know what else I should try, can anyone helpe me, please?
Cheers
As #obe said this is likely a proxmox or whatever is instigating systemd without sufficient privileges is the issue.
The devices.allow error is probably requested by the PrivateDevices=true (seems confirmed based on MDEV-13207 which failed to provide more info) aspect of the systemd service file for MariaDB.
PrivateDevices=true allows:
/dev/null
/dev/zero
/dev/random
Based on this answer for a different device, doing the equivalent for these devices would be:
lxc config set mycontainer raw.lxc 'lxc.cgroup.devices.allow = c 1:3 rwm'
lxc config set mycontainer raw.lxc 'lxc.cgroup.devices.allow = c 1:8 rwm'
lxc config set mycontainer raw.lxc 'lxc.cgroup.devices.allow = c 1:5 rwm'
Major/minor device code determined by:
$ ls -la /dev/zero /dev/random /dev/null
crw-rw-rw-. 1 root root 1, 3 Jan 8 22:20 /dev/null
crw-rw-rw-. 1 root root 1, 8 Jan 8 22:20 /dev/random
crw-rw-rw-. 1 root root 1, 5 Jan 8 22:20 /dev/zero
Thanks all for the answer.
#danblack Nothing change, suddenly stop working, but reading this forum I found the solution in this thread.
Can't start MariaDB on debian 10
Basically the solution is ...
"Solved it by deleting/renaming the tc.log mv -vi /var/lib/mysql/tc.log /root And restarting the database service mysql restart"
And mariaddb start again.

Deploy Flask with Gunicorn and NginX Gunicorn Error "Failed with result 'exit-code'"

I'm following this YouTube Tutorial to setup my Server with Flask and Nginx: https://www.youtube.com/watch?v=o2WA-A67Bks&t=360s
Right now I'm at the Gunicorn part. I tried to start following commands:
systemctl daemon-reload
systemctl start index
systemctl enable index
systemctl status index
But it doesn't work. The Error Message looks like this:
● index.service - Gunicorn instance to serve One
Loaded: loaded (/etc/systemd/system/index.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2020-12-01 18:14:40 CET; 8s ago
Main PID: 24620 (code=exited, status=203/EXEC)
Dez 01 18:14:40 h2912959.stratoserver.net systemd[1]: Started Gunicorn instance to serve One.
Dez 01 18:14:40 h2912959.stratoserver.net systemd[24620]: index.service: Failed to execute command: No such file or directory
Dez 01 18:14:40 h2912959.stratoserver.net systemd[24620]: index.service: Failed at step EXEC spawning /var/www/html/myprojectenv/bin/gunicorn: No such file or directory
Dez 01 18:14:40 h2912959.stratoserver.net systemd[1]: index.service: Main process exited, code=exited, status=203/EXEC
Dez 01 18:14:40 h2912959.stratoserver.net systemd[1]: index.service: Failed with result 'exit-code'.
My index.service file looks like that:
[Unit]
Description=Gunicorn instance to serve One
After=network.target
[Service]
User=daemon
Group=www-data
WorkingDirectory=/var/www/html
Environment="PATH=/var/www/html/myprojectenv/bin"
ExecStart=/var/www/html/myprojectenv/bin/gunicorn --workers 3 --bind unix:myproject.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.target
Can please help anyone?

Kibana - process not starting- log not clear

Running on Ubuntu 16.4
Elastic version: 6.2.4
Kibana version: 6.2.4
Elastic is up and running on port 9200.
Kibana suddenly stopped working, I am trying to run the start command: sudo systemctl start kibana.service and I get the following error in the service stdout(journalctl -fu kibana.service):
Started Kibana.
Aug 27 12:54:33 ubuntuserver systemd[1]: kibana.service: Main process exited, code=exited, status=1/FAILURE
Aug 27 12:54:33 ubuntuserver systemd[1]: kibana.service: Unit entered failed state.
Aug 27 12:54:33 ubuntuserver systemd[1]: kibana.service: Failed with result 'exit-code'.
Aug 27 12:54:33 ubuntuserver systemd[1]: kibana.service: Service hold-off time over, scheduling restart.
Aug 27 12:54:33 ubuntuserver systemd[1]: Stopped Kibana.
No details on this log.
My yaml configuration has only this props:
server.port: 5601
server.host: "0.0.0.0"
I also have tried writing to a log file(hoping for more info there), I tried adding this configurations:
logging.dest: /var/log/kibana/kibana.log
logging.verbose: true
I gave the folder/file full access control but nothing is being written there(still writing to the stdout)

MariaDB Galera does not bootstrap the first node

I have installed ubuntu 16.04 on a VMware VM. Then I added the repo from mariadb website and I installed the latest version of mariadb 10.1.
The installation works fine
I have then created a file
sudo nano /etc/mysql/conf.d/cluster.cnf
with the following
[mysqld]
# Cluster node configurations
wsrep_cluster_address="gcomm://20.0.1.51"
wsrep_node_address="20.0.1.51"
innodb_buffer_pool_size=800M
# Mandatory settings to enable Galera
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
binlog_format=ROW
default-storage-engine=InnoDB
innodb_autoinc_lock_mode=2
innodb_doublewrite=1
query_cache_size=0
bind-address=0.0.0.0
# Galera synchronisation configuration
wsrep_sst_method=rsync
I want only to bootstrap the first node and then add new nodes
So I run
sudo service mysql bootstrap
But I get this error
Jul 03 02:38:07 db1 mysqld[14779]: at gcomm/src/pc.cpp:connect():162
Jul 03 02:38:07 db1 mysqld[14779]: 2016-07-03 2:38:07 140418873596160 [ERROR] WSREP: gcs/src/gcs_core.cpp:gcs_core_open():208: Failed to open backend connection: -110 (Connection timed ou
Jul 03 02:38:07 db1 mysqld[14779]: 2016-07-03 2:38:07 140418873596160 [ERROR] WSREP: gcs/src/gcs.cpp:gcs_open():1379: Failed to open channel 'my_wsrep_cluster' at 'gcomm://20.0.1.51': -11
Jul 03 02:38:07 db1 mysqld[14779]: 2016-07-03 2:38:07 140418873596160 [ERROR] WSREP: gcs connect failed: Connection timed out
Jul 03 02:38:07 db1 mysqld[14779]: 2016-07-03 2:38:07 140418873596160 [ERROR] WSREP: wsrep::connect(gcomm://20.0.1.51) failed: 7
Jul 03 02:38:07 db1 mysqld[14779]: 2016-07-03 2:38:07 140418873596160 [ERROR] Aborting
Jul 03 02:38:08 db1 systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jul 03 02:38:08 db1 systemd[1]: Failed to start MariaDB database server.
Jul 03 02:38:08 db1 systemd[1]: mariadb.service: Unit entered failed state.
Jul 03 02:38:08 db1 systemd[1]: mariadb.service: Failed with result 'exit-code'.
What am I doing wrong??
Its the systemd thing. On systems that has systemd, one should use galera_new_cluster to bootstrap a new cluster.
https://mariadb.com/kb/en/mariadb/systemd/

Server error 500 on MAMP after attempted transfer of existing wordpress site

I am trying to copy a live wordpress site and make it work locally on MAMP. But when I load up the site I get a 500 error.
What I did.
Downloaded whole site from ftp server and placed in MAMP htdocs directory in a folder.
Exported SQL Database from live site.
Started MAMP and imported sql database.
Added user with privileges for the imported database (with same name and password from live site)
Edited wp-options siteurl and home to http://localhost:8888/
Changed the DB_HOST to localhost in wp-config.php
wouldn't work so installed new a wordpress site in a separate directory in htdocs to see what would happen and that works.
What do I do?
The most recent from log
[Tue Dec 15 16:00:37 2015] [error] [client ::1] File does not exist: /Applications/MAMP/htdocs/websites/docs-assets, referer: http://localhost:8888/MAMP/?language=English
[Tue Dec 15 16:26:49 2015] [notice] caught SIGTERM, shutting down
[Tue Dec 15 16:34:01 2015] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 15 16:34:01 2015] [notice] Digest: done
[Tue Dec 15 16:34:01 2015] [notice] FastCGI: process manager initialized (pid 6169)
[Tue Dec 15 16:34:01 2015] [notice] Apache/2.2.29 (Unix) mod_wsgi/3.5 Python/2.7.10 PHP/5.6.10 mod_ssl/2.2.29 OpenSSL/0.9.8zg DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.22.0 configured -- resuming normal operations
most recent SQL log
151215 16:26:51 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
151215 16:34:01 mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql
151215 16:34:01 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
151215 16:34:01 [Note] Plugin 'FEDERATED' is disabled.
151215 16:34:01 InnoDB: The InnoDB memory heap is disabled
151215 16:34:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151215 16:34:01 InnoDB: Compressed tables use zlib 1.2.3
151215 16:34:01 InnoDB: Initializing buffer pool, size = 128.0M
151215 16:34:01 InnoDB: Completed initialization of buffer pool
151215 16:34:01 InnoDB: highest supported file format is Barracuda.
151215 16:34:01 InnoDB: Waiting for the background threads to start
151215 16:34:02 InnoDB: 5.5.42 started; log sequence number 4458593
151215 16:34:02 [Note] Event Scheduler: Loaded 0 events
151215 16:34:02 [Note] /Applications/MAMP/Library/bin/mysqld: ready for connections.
Version: '5.5.42' socket: '/Applications/MAMP/tmp/mysql/mysql.sock' port: 0 Source distribution
PHP log when I reload site
[15-Dec-2015 16:47:21 Europe/London] PHP Warning: require_once(/Applications/MAMP/htdocs/websites/cakesandcatering/wp-config.php): failed to open stream: Permission denied in /Applications/MAMP/htdocs/websites/cakesandcatering/wp-load.php on line 29
[15-Dec-2015 16:47:21 Europe/London] PHP Fatal error: require_once(): Failed opening required '/Applications/MAMP/htdocs/websites/cakesandcatering/wp-config.php' (include_path='.:/Applications/MAMP/bin/php/php5.6.10/lib/php') in /Applications/MAMP/htdocs/websites/cakesandcatering/wp-load.php on line 29
line 29 on load.php is
/** The config file resides in ABSPATH */
require_once( ABSPATH . 'wp-config.php' );

Resources