2

Main purpose

I am trying to install a local version of Prestashop on my ubuntu server 20.04 following those steps.

Issue

I am currently trying to install MariaDB (Step 5 of the guide) and after trying to run the command sudo mysql_secure_installation the terminal returns:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 

after entering the password:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

What I have tried

I have tried to look around and checking my sockets using sudo find / -type s I found out that there isn't any /var/lib/mysql folders.

the output of sudo find / -type s:

/var/lib/samba/private/msg.sock/995
/var/lib/samba/private/msg.sock/1018
/var/lib/samba/private/msg.sock/1140
/var/lib/samba/private/msg.sock/978
/var/lib/samba/private/msg.sock/774
/var/lib/samba/private/msg.sock/1173
/var/lib/samba/private/msg.sock/1002
/var/lib/samba/private/msg.sock/954
/var/lib/samba/private/msg.sock/1139
/var/lib/samba/private/msg.sock/1211
/var/lib/samba/private/msg.sock/1312
/var/lib/samba/private/msg.sock/1186
/var/lib/samba/private/msg.sock/959
/var/lib/samba/private/msg.sock/937
/var/lib/samba/private/msg.sock/1161
/var/lib/samba/private/msg.sock/1225
/var/lib/samba/private/msg.sock/1009
/var/lib/samba/private/msg.sock/1160
/var/lib/samba/private/msg.sock/19992
/var/lib/samba/private/msg.sock/19790
/var/lib/samba/private/msg.sock/1322
/var/lib/samba/private/msg.sock/1254
/var/lib/samba/private/msg.sock/19755
/var/lib/samba/private/msg.sock/19789
/var/lib/samba/private/msg.sock/20005
/var/lib/samba/private/msg.sock/770
/var/lib/samba/private/msg.sock/26712
/var/lib/samba/private/msg.sock/702
/var/lib/samba/private/msg.sock/1227
/var/lib/samba/private/msg.sock/1200
/var/lib/samba/private/msg.sock/1291
/var/lib/samba/winbindd_privileged/pipe
/var/spool/postfix/private/local
/var/spool/postfix/private/proxymap
/var/spool/postfix/private/trace
/var/spool/postfix/private/error
/var/spool/postfix/private/lmtp
/var/spool/postfix/private/relay
/var/spool/postfix/private/anvil
/var/spool/postfix/private/maildrop
/var/spool/postfix/private/verify
/var/spool/postfix/private/mailman
/var/spool/postfix/private/bounce
/var/spool/postfix/private/smtp
/var/spool/postfix/private/defer
/var/spool/postfix/private/virtual
/var/spool/postfix/private/discard
/var/spool/postfix/private/bsmtp
/var/spool/postfix/private/tlsmgr
/var/spool/postfix/private/rewrite
/var/spool/postfix/private/ifmail
/var/spool/postfix/private/proxywrite
/var/spool/postfix/private/retry
/var/spool/postfix/private/scache
/var/spool/postfix/private/scalemail-backend
/var/spool/postfix/private/uucp
/var/spool/postfix/public/postlog
/var/spool/postfix/public/showq
/var/spool/postfix/public/cleanup
/var/spool/postfix/public/flush
/var/spool/postfix/public/qmgr
/var/spool/postfix/public/pickup
/var/spool/postfix/dev/log
/var/snap/lxd/common/lxd/unix.socket
/run/php/php7.2-fpm.sock
/run/dovecot/master
/run/dovecot/anvil-auth-penalty
/run/dovecot/anvil
/run/dovecot/auth-worker
/run/dovecot/auth-master
/run/dovecot/auth-userdb
/run/dovecot/auth-client
/run/dovecot/auth-login
/run/dovecot/config
/run/dovecot/dict-async
/run/dovecot/dict
/run/dovecot/director-userdb
/run/dovecot/director-admin
/run/dovecot/dns-client
/run/dovecot/doveadm-server
/run/dovecot/imap-hibernate
/run/dovecot/imap-urlauth
/run/dovecot/imap-urlauth-worker
/run/dovecot/imap-master
/run/dovecot/indexer
/run/dovecot/indexer-worker
/run/dovecot/ipc
/run/dovecot/log-errors
/run/dovecot/old-stats
/run/dovecot/replication-notify
/run/dovecot/replicator
/run/dovecot/stats-writer
/run/dovecot/stats-reader
/run/dovecot/token-login/tokenlogin
/run/dovecot/token-login/imap-urlauth
/run/dovecot/login/login
/run/dovecot/login/imap
/run/dovecot/login/ipc-proxy
/run/dovecot/login/pop3
/run/irqbalance/irqbalance767.sock
/run/uuidd/request
/run/snapd-snap.socket
/run/snapd.socket
/run/dbus/system_bus_socket
/run/user/1000/snapd-session-agent.socket
/run/user/1000/pk-debconf-socket
/run/user/1000/gnupg/S.gpg-agent
/run/user/1000/gnupg/S.gpg-agent.ssh
/run/user/1000/gnupg/S.gpg-agent.extra
/run/user/1000/gnupg/S.gpg-agent.browser
/run/user/1000/gnupg/S.dirmngr
/run/user/1000/bus
/run/user/1000/systemd/private
/run/user/1000/systemd/notify
/run/user/1000/inaccessible/sock
/run/samba/winbindd/pipe
/run/samba/nmbd/unexpected
/run/postgresql/.s.PGSQL.5432
/run/lvm/lvmpolld.socket
/run/systemd/journal/io.systemd.journal
/run/systemd/journal/socket
/run/systemd/journal/stdout
/run/systemd/journal/dev-log
/run/systemd/journal/syslog
/run/systemd/userdb/io.systemd.DynamicUser
/run/systemd/private
/run/systemd/notify
/run/systemd/inaccessible/sock
/run/udev/control

Edit

  1. I tried to mkdir /var/lib/mysql and the weirdly the output is:
mkdir: cannot create directory ‘/var/lib/mysql’: File exists
  1. I tried starting MariaDB with systemctl start mariadb and the output is:
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.

I then checked the status of it with systemctl status mariadb.service

● mariadb.service - MariaDB 10.3.22 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor pres>
     Active: failed (Result: exit-code) since Sun 2020-05-10 12:19:19 UTC; 11s >
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 38200 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /va>
    Process: 38206 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_S>
    Process: 38215 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] &&>
    Process: 38264 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER >
   Main PID: 38264 (code=exited, status=1/FAILURE)

May 10 12:19:18 chale-server systemd[1]: Starting MariaDB 10.3.22 database serv>
May 10 12:19:18 chale-server mysqld[38264]: 2020-05-10 12:19:18 0 [Note] /usr/s>
May 10 12:19:19 chale-server systemd[1]: mariadb.service: Main process exited, >
May 10 12:19:19 chale-server systemd[1]: mariadb.service: Failed with result 'e>
May 10 12:19:19 chale-server systemd[1]: Failed to start MariaDB 10.3.22 databa>

and journalctl -xe output is:

May 10 12:19:19 chale-server systemd[1]: mariadb.service: Main process exited, >
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit mariadb.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
May 10 12:19:19 chale-server systemd[1]: mariadb.service: Failed with result 'e>
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit mariadb.service has entered the 'failed' state with result 'exit-co>
May 10 12:19:19 chale-server systemd[1]: Failed to start MariaDB 10.3.22 databa>
-- Subject: A start job for unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit mariadb.service has finished with a failure.
-- 
-- The job identifier is 6206 and the job result is failed.
May 10 12:19:19 chale-server polkitd(authority=local)[859]: Unregistered Authen>

Other information

I'm not sure if I should include that I am running the server trough ssh connection using my macbook...

  • The ">" signs on the very right of the log show that there is missing something due to screenwidth, please append that. Also, you start the server at 12:19:18 but show us the systemd log from 12:19:19, so that the important part - which is before that - is missing. Please add that. – rexkogitans May 11 '20 at 9:09
0

Do systemctl start mariadb, then try again. It looks like MariaDB was never started.

  • I updated the question with the error I am receiving – Alessandro Candeloro May 10 '20 at 12:29
  • Can you do grep mysql /var/log/syslog? That's where the error will be by default, or wherever log-error is set to in /etc/my* – Gordan Bobic May 10 '20 at 16:32
  • @GordanBobic no, the OP is on a systemd system that is setup to use systemd-journal instead. – rexkogitans May 11 '20 at 5:52
  • Systemd journal doesn't capture everything that goes into syslog. – Gordan Bobic May 11 '20 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.