
Bei der Neuinstallation von Ubuntu 16.04 und der Neuinstallation von MySQL habe ich meine MySQL-Daten auf ähnliche Weise verschoben wieDasWenn ich jedoch danach versuche, MySQL neu zu starten/zu posten, erhalte ich Folgendes:
error: can't connect to local MySQL server throught socket '/var/run/mysqld/mysql.sock' (2)
Check that mysqld is running and that the socket: '/var/run/mysqld/mysql.sock' exists!
Der Ordner /var/run/mysqld existiert, aber nicht die Datei.
Wenn ich ausführe: find / -type s
Die Datei mysql.sock ist nicht auf der Liste.
Das Ergebnis von journalctl -xe
:
-- Unit mysql.service has finished shutting down.
Jun 12 11:45:16 wkssop-hev7 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mysql.service has begun starting up.
Jun 12 11:45:16 wkssop-hev7 audit[5882]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/5882/status" pid=5882 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=110 ouid=110
Jun 12 11:45:16 wkssop-hev7 audit[5882]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=5882 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=110 ouid=0
Jun 12 11:45:16 wkssop-hev7 audit[5882]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/5882/status" pid=5882 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=110 ouid=110
Jun 12 11:45:16 wkssop-hev7 kernel: audit: type=1400 audit(1497260716.044:133): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/5882/status" pid=5882 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=110 ouid=110
Jun 12 11:45:16 wkssop-hev7 kernel: audit: type=1400 audit(1497260716.044:134): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=5882 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=110 ouid=0
Jun 12 11:45:16 wkssop-hev7 kernel: audit: type=1400 audit(1497260716.044:135): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/5882/status" pid=5882 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=110 ouid=110
Jun 12 11:45:17 wkssop-hev7 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Und das Ergebnis systemctl status mysql.service
ist:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Mon 2017-06-12 11:45:46 CEST; 6s ago
Process: 5986 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 5978 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 5986 (code=exited, status=1/FAILURE); : 5987 (mysql-systemd-s)
Tasks: 2
Memory: 1.4M
CPU: 259ms
CGroup: /system.slice/mysql.service
└─control
├─5987 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─6029 sleep 1
Jun 12 11:45:46 wkssop-hev7 systemd[1]: Starting MySQL Community Server...
Jun 12 11:45:48 wkssop-hev7 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Dies sind im Wesentlichen die Schritte, die ich befolge:
if ! service mysql stop ; then
echo "ignoring failure to stop mysql"
fi
cp config/my.cnf /etc/mysql/my.cnf
mkdir -p /data/mysqldata
chmod 777 /data/mysqldata
cp -R -p /var/lib/mysql/* /data/mysqldata
sed "s/\/var\/lib\/mysql/\/data\/mysqldata/g" /etc/apparmor.d/usr.sbin.mysqld > tmp
mv tmp /etc/apparmor.d/usr.sbin.mysqld
apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld
/etc/init.d/apparmor reload
service mysql restart
Beim letzten Schritt erhalte ich die Fehlermeldung „Dienst neu starten“, da dies nicht möglich ist.
Ich habe außerdem /sys/devices/system/node/ r und /sys/devices/system/node/** r zum MySQL-Apparmor-Profil hinzugefügt, da es ein Fehler zu sein schien, dass sie nicht vorhanden sind:https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1658233
Aber jetzt frage ich mich, ob ich dasselbe mit /proc/####/status machen sollte. Nun, eigentlich müsste es /proc sein, schätze ich? Also dachte ich, ich könnte es genauso gut versuchen, aber es schlägt immer noch fehl.
journatlctl -xe | tail -30:
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Jun 14 13:28:50 minint-l35opp1 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Jun 14 13:29:18 minint-l35opp1 systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Jun 14 13:29:18 minint-l35opp1 systemd[1]: mysql.service: Unit entered failed state.
Jun 14 13:29:18 minint-l35opp1 systemd[1]: mysql.service: Failed with result 'exit-code'.
Jun 14 13:29:18 minint-l35opp1 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jun 14 13:29:18 minint-l35opp1 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Jun 14 13:29:18 minint-l35opp1 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Jun 14 13:29:20 minint-l35opp1 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Antwort1
Der letzte Fehler, den ich erhalten habe, führte mich zu Folgendem:https://askubuntu.com/a/792857/693474Antwort ... die mein Problem gelöst hat. Obwohl ich nicht verstehe, warum diese beiden Parameter überhaupt dort waren, da dies eine Neuinstallation war?