fail to start mysql on CentOS7 - mysql

I installed mysql in my server. But it failed to start.
The error shows here:
the systemctl status mysqld.service info:
[root#localhost run]# systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Sat 2021-05-29 10:47:55 CST; 35s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 256566 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=217/USER)
May 29 10:47:55 localhost.localdomain systemd[1]: Failed to start MySQL Server.
May 29 10:47:55 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
May 29 10:47:55 localhost.localdomain systemd[1]: mysqld.service failed.
May 29 10:47:55 localhost.localdomain systemd[1]: mysqld.service holdoff time over, sche...t.
May 29 10:47:55 localhost.localdomain systemd[1]: Stopped MySQL Server.
May 29 10:47:55 localhost.localdomain systemd[1]: start request repeated too quickly for...ce
May 29 10:47:55 localhost.localdomain systemd[1]: Failed to start MySQL Server.
May 29 10:47:55 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
May 29 10:47:55 localhost.localdomain systemd[1]: mysqld.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
thejournalctl -xeinfo:
May 29 10:48:00 localhost.localdomain postfix/master[21438]: warning: process /usr/libexec/postfix/pickup pid 257074 exit status 127
May 29 10:48:00 localhost.localdomain postfix/master[21438]: warning: /usr/libexec/postfix/pickup: bad command startup -- throttling
May 29 10:49:00 localhost.localdomain postfix/master[21438]: warning: process /usr/libexec/postfix/pickup pid 263057 exit status 127
May 29 10:49:00 localhost.localdomain postfix/master[21438]: warning: /usr/libexec/postfix/pickup: bad command startup -- throttling
May 29 10:50:00 localhost.localdomain postfix/master[21438]: warning: process /usr/libexec/postfix/pickup pid 269083 exit status 127
May 29 10:50:00 localhost.localdomain postfix/master[21438]: warning: /usr/libexec/postfix/pickup: bad command startup -- throttling
May 29 10:50:01 localhost.localdomain systemd[1]: Started Session 2986 of user root.
-- Subject: Unit session-2986.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-2986.scope has finished starting up.
--
-- The start-up result is done.
I tried to run chown -R mysql:mysql /var/lib/mysql, It shows like this:
chown: invalid user: ‘mysql:mysql’
How can I start mysql?

You can fix this in few steps
Execute this command to check if mysql user exists: cat /etc/passwd | grep mysql
Validate if you have mysql in this file. It should look something like : mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/false
If mysql user is not present please create that user like this : useradd -d /var/lib/mysql mysql
If mysql user is present then make sure mysql user home path in /etc/passwd file actually exists and owned by mysql user (in the above case I mentioned /var/lib/mysql is home path and it has to be owned by mysql user)
Note: from what ever you have mentioned it looked like mysql user doesn't exist in your system. So it looks like creating the user with home path as /var/lib/mysql should solve the problem.

Related

mysql does not restart

I've tried to restart mysql 5.7 :
service mysql restart
But it fails and i do not understand why :
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
And I dont see what's wrong in the logs :
systemctl status mariadb.service
● mariadb.service - MariaDB 10.1.37 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-02-25 22:02:52 GMT; 1min 9s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 15467 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=127)
Main PID: 28679 (code=exited, status=0/SUCCESS)
Feb 25 22:02:52 stretch systemd[1]: Starting MariaDB 10.1.37 database server...
Feb 25 22:02:52 stretch systemd[1]: mariadb.service: Control process exited, code=exited status=127
Feb 25 22:02:52 stretch systemd[1]: Failed to start MariaDB 10.1.37 database server.
Feb 25 22:02:52 stretch systemd[1]: mariadb.service: Unit entered failed state.
Feb 25 22:02:52 stretch systemd[1]: mariadb.service: Failed with result 'exit-code'.
Any help would be welcome...
I'm on Debian 9, with 1800Mo in ram free.
Here is what the journal says :
journalctl -xe
Feb 26 08:09:01 stretch CRON[16792]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 26 08:09:01 stretch CRON[16793]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Feb 26 08:09:01 stretch CRON[16792]: pam_unix(cron:session): session closed for user root
Feb 26 08:17:01 stretch CRON[16794]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 26 08:17:01 stretch CRON[16795]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Feb 26 08:17:01 stretch CRON[16794]: pam_unix(cron:session): session closed for user root
Feb 26 08:25:23 stretch systemd[1]: Starting MariaDB 10.1.37 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.
Feb 26 08:25:23 stretch systemd[1]: mariadb.service: Control process exited, code=exited status=127
Feb 26 08:25:23 stretch systemd[1]: Failed to start MariaDB 10.1.37 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.
Feb 26 08:25:23 stretch systemd[1]: mariadb.service: Unit entered failed state.
Feb 26 08:25:23 stretch systemd[1]: mariadb.service: Failed with result 'exit-code'.
I also got this error when upgrading to Debian Buster (from MariaDB 10.1 to 10.3). Running mysqld myself and mysql_upgrade both worked anyways. Try executing the following command to restart systemd on the fly. See also https://unix.stackexchange.com/a/419375.
systemctl daemon-reexec
If you don't do this, a reboot will probably fix this as well. Commenting out the ExecStartPre in /etc/systemd/system/mysql.service was not enough as the other ExecStartPre commands then failed instead (also with the exit code 127, i.e. "command not found").
Under Process: is the ExecStartPre returning with an error exist status
Based on error 127, I'd suspect that /usr/bin/install doesn't exist.

Trouble setting up screen sharing on Fedora 27 Desktop

I'm running Fedora 27 Desktop edition with GNOME. I've tried instructions from all over the web, but haven't found anything that lets me set up sharing my screen with a remote user. Can anyone help me with this?
Thank you very much in advance for your response.
Here's the story so far:
========
I initially tried:
Activies -> Show Application -> Settings -> Sharing
and saw options:
File Sharing
Media Sharing
Remote Login
But saw no option for Screen Sharing, which one page suggested should be present.
========
I've looked at:
https://docs.fedoraproject.org/f27/system-administrators-guide/Wayland.html
and run
$ echo $WAYLAND_DISPLAY
which yields
wayland-0
but I can't find out how to use this information to solve my problem. I also don't find documentation that screen sharing on Wayland under Fedora 27 is working.
========
Of the many solutions I've tried, I made the best progress by following instructions at https://docs.fedoraproject.org/f27/system-administrators-guide/infrastructure-services/TigerVNC.html
The following commands worked:
sudo dnf install tigervnc-server
sudo cp /lib/systemd/system/vncserver#.service /etc/systemd/system/vncserver#.service
Then I edited /etc/systemd/system/vncserver#.service, replacing <USER> with my user name in the following two lines:
ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i -geometry 1280x1024"
PIDFile=/home/<USER>/.vnc/%H%i.pid
Then I ran:
sudo systemctl daemon-reload
and set a password with:
vncpasswd
Next the site's instructions told me:
With a valid display number, execute the following command:
sudo systemctl enable vncserver#:display_number.service
I've tried using display numbers 0, 1, and 2.
With display number as 1, for example, I got different error messages depending on whether SELinux was set to Enforcing or Permissive.
sudo systemctl start vncserver#:1.service
With 'Enforcing':
Job for vncserver#:1.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status vncserver#:1.service" and "journalctl -xe" for details.
After trying the following steps suggested by SELinux:
sudo ausearch -c 'systemd' --raw | audit2allow -M my-systemd
semodule -i my-systemd.pp
and:
sudo ausearch -c 'geoclue' --raw | audit2allow -M my-geoclue
sudo semodule -i my-geoclue.pp
the error message changed to be same as given here for 'Permissive':
Job for vncserver#:1.service failed because the control process exited with error code.
See "systemctl status vncserver#:1.service" and "journalctl -xe" for details.
The output of systemctl status vncserver#:1.service was as follows:
● vncserver#:1.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver#.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2018-03-26 12:24:12 EDT; 3min 4s ago
Process: 23294 ExecStart=/usr/sbin/runuser -l jazcap53 -c /usr/bin/vncserver :1 (code=exited, status=98)
Process: 23292 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill :1 > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Mar 26 12:24:12 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...
Mar 26 12:24:12 localhost.localdomain systemd[1]: vncserver#:1.service: Control process exited, code=exited status=98
Mar 26 12:24:12 localhost.localdomain systemd[1]: Failed to start Remote desktop service (VNC).
Mar 26 12:24:12 localhost.localdomain systemd[1]: vncserver#:1.service: Unit entered failed state.
Mar 26 12:24:12 localhost.localdomain systemd[1]: vncserver#:1.service: Failed with result 'exit-code'.
And sudo journalctl -xe produced:
Mar 26 12:27:41 localhost.localdomain systemd[1]: Started SSSD Kerberos Cache Manager.
-- Subject: Unit sssd-kcm.service has finished start-up
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit sssd-kcm.service has finished starting up.
--
-- The start-up result is done.
Mar 26 12:27:41 localhost.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=sssd-kcm c
Mar 26 12:27:41 localhost.localdomain sssd[kcm][23679]: Starting up
Mar 26 12:27:41 localhost.localdomain systemd[1]: Started SSSD Secrets Service responder.
-- Subject: Unit sssd-secrets.service has finished start-up
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit sssd-secrets.service has finished starting up.
--
-- The start-up result is done.
Mar 26 12:27:41 localhost.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=sssd-secre
Mar 26 12:27:41 localhost.localdomain sssd[secrets][23680]: Starting up
Mar 26 12:30:04 localhost.localdomain sudo[23858]: jazcap53 : TTY=pts/0 ; PWD=/home/jazcap53 ; USER=root ; COMMAND=/bin/journalctl -xe
Mar 26 12:30:04 localhost.localdomain audit[23858]: USER_CMD pid=23858 uid=1001 auid=1001 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg
Mar 26 12:30:04 localhost.localdomain audit[23858]: CRED_REFR pid=23858 uid=0 auid=1001 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='
Mar 26 12:30:04 localhost.localdomain sudo[23858]: pam_systemd(sudo:session): Cannot create session: Already occupied by a session
Mar 26 12:30:04 localhost.localdomain audit[23858]: USER_START pid=23858 uid=0 auid=1001 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg=
Mar 26 12:30:04 localhost.localdomain sudo[23858]: pam_unix(sudo:session): session opened for user root by (uid=0)
If you do not have Vino installed, GNOME will not display Screen Sharing as an option.
sudo dnf install vino should do it. You can then set up screenshare as per your initial attempt.

How can I reinstate a MariaDB server process that is simply no longer running?

For a particular project I wanted to have Mint (Sonja) appliance with all MariaDB and only MariaDB doing MySQL's work, without a hint of MySQL so I know I'm working with MariaDB.
The appliance is one where I've installed multiple open source projects that power their own website (Alfresco, Request Tracker, SuiteCRM, etc.), and all of them seem to have worked either with MariaDB, or just used Postgres without interesting difficulty, and up until I tried to create a new MariaDB database to add a clone of a specific Wordpress site, MariaDB worked predictably well with no headaches on the same system. Until now, where I can't seem to find a pulse.
The MariaDB troubleshooting page confirmed what I'd found in my investigations (in particular, a ps wwaux | grep mysql only turned up the grep process). The basic problem as I'd encountered it was when I tried to log in to create a database:
monk#toolchest ~ $ mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
I've never gotten involved with MySQL's or MariaDB's /etc configuration files, but I looked briefly. They appeared sane to my uneducated eye.
Neither an aptitude reinstall mariadb-server nor a service mysql start produce any changes so far as I could tell.
For service mysql start, I got:
# service mysql start
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
The details for systemctl status mysql.service were:
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2017-07-14 18:16:38 EEST; 1min 11s ago
Docs: man:systemd-sysv-generator(8)
Process: 5011 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]: 0 processes alive and '/usr/bin/mysql
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]: [61B blob data]
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]: error: 'Can't connect to local MySQL
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]: Check that mysqld is running and that
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]:
Jul 14 18:16:38 toolchest mysql[5011]: ...fail!
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Control process exited, code=exited
Jul 14 18:16:38 toolchest systemd[1]: Failed to start LSB: Start and stop the mysql data
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Unit entered failed state.
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Failed with result 'exit-code'.
The recent (i.e. non-cronned) content of journalctl -xe ran:
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Unit entered failed state.
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Failed with result 'exit-code'.
/etc/mysql/mariadb.cnf and /etc/mysql/my.cnf both read (comments stripped):
[client-server]
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
/etc/mysql/my.cnf.fallback dropps the latter !includedir. Commenting out the latter /etc/mysql/my.cnf to match the fallback file produced identical results.
I can edit my question to include more of /etc/mysql/*, but I wanted to ask. Error messages similar to the ERROR 2002 are to be found in questions like Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (38), but these appear to be MySQL rather than MariaDB, and I suspect this may be a MariaDB-specific fluke.

Mysql Error ERROR 2002 (HY000) persists after full reinstall

So I've been working on a rails server with MySQL and suddenly can't access my database. When I try to log in with mysql -u root -p I get ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2). I've read most of the forums I can find and looked through all the logs trying to reset mysqld.sock. I've tried reinstalling and repackaging unsuccessfully. The weird thing is that var/run/mysqld/ doesn't even exist after reinstalling.
So I decided to just back up my databases and overhaul everything. I cleaned out both apache and mysql with apt-get remove --purge and reinstalled. All went fine, apache launched fine, and then tried to relaunch mysql with systemctl start mysql which gave a prompt to check the log which says:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Fri 2016-12-16 23:56:19 UTC; 17s ago
Process: 15690 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Control process exited, code=exited status=1
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: Failed to start MySQL Community Server.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Unit entered failed state.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Failed with result 'exit-code'.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: Stopped MySQL Community Server.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Start request repeated too quickly.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: Failed to start MySQL Community Server.
Update - I created the folder mysqld, which seems to allow sudo mysqld --initialize to run. Unfortunately this yielded the error
2016-12-17T00:16:36.298825Z 0 [ERROR] Can't change data directory owner to mysql
2016-12-17T00:16:36.299212Z 0 [ERROR] Aborting
So no party yet. Any thoughts would be hugely appreciated.
edit /etc/mysql/conf.d/mysql.cnf :
sudo nano /etc/mysql/conf.d/mysql.cnf
add this line :
socket=/var/run/mysqld/mysqld.sock
then restart mysql service :
sudo service mysql restart

mysql randomly stopped working

hi my mysql was working i did nothing on it then today when i went to login to multicraft it gave me error 500 which means theres an issue with mysql and i tried to do $service mysql restart it didnt work so i did $service mysql status and i got this error
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Wed 2016-01-27 16:39:39 CET; 24min >ago
Process: 27320 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
Process: 28147 ExecStart=/etc/init.d/mysql start (code=exited, >status=1/FAILURE)
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu systemd[1]: Starting LSB: Start and >sto...
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu mysql[28147]: /etc/init.d/mysql: >ERROR:...
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu systemd[1]: mysql.service: control >proc...
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu systemd[1]: Failed to start LSB: Start >...
Jan 27 16:39:39 ns3317389.ip-37-59-14.eu systemd[1]: Unit mysql.service entered >...
Hint: Some lines were ellipsized, use -l to show in full.
look in your /var/log/mysql/*.log logs
try to start mysql on the commandline
Example:
as root user: mysqld --console