ubuntu mysql不工作

cxfofazt  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(393)

ubuntu 16.04版。当我尝试“sudo service mysql restart”时,结果是:

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

mysql服务状态:

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled)
   Active: activating (start-post) (Result: exit-code) since Sun 2018-06-10 17:07:52 +05; 29s ago
  Process: 1515 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 1505 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 1515 (code=exited, status=1/FAILURE);         : 1516 (mysql-systemd-s)
   CGroup: /system.slice/mysql.service
           └─control
             ├─1516 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─1698 sleep 1
Jun 10 17:10:24 murabye-extensa systemd[1]: Starting MySQL Community Server...
Jun 10 17:10:26 murabye-extensa systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

日志:

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has failed.
-- 
-- The result is failed.
Jun 10 17:11:25 murabye-extensa systemd[1]: mysql.service: Unit entered failed state.
Jun 10 17:11:25 murabye-extensa systemd[1]: mysql.service: Failed with result 'exit-code'.
Jun 10 17:11:25 murabye-extensa systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jun 10 17:11:25 murabye-extensa 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 10 17:11:25 murabye-extensa 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 10 17:11:25 murabye-extensa audit[2427]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/2427/status" pid=2427 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=122 ouid=122
Jun 10 17:11:25 murabye-extensa audit[2427]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=2427 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=122 ouid=0
Jun 10 17:11:25 murabye-extensa audit[2427]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/2427/status" pid=2427 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=122 ouid=122
Jun 10 17:11:25 murabye-extensa kernel: audit: type=1400 audit(1528632685.885:6767): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/2427/status" pid=2427 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=122 ouid=122
Jun 10 17:11:25 murabye-extensa kernel: audit: type=1400 audit(1528632685.885:6768): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=2427 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=122 ouid=0
Jun 10 17:11:25 murabye-extensa kernel: audit: type=1400 audit(1528632685.885:6769): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/2427/status" pid=2427 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=122 ouid=122
Jun 10 17:11:27 murabye-extensa systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

之前,我尝试将默认文本编码更改为utf-8:

sudo nano /etc/mysql/conf.d/utf8_set.cnf

现在我有了这个(在档案里)

[mysqld]
default-character-set=utf8

[client]
default-character-set=utf8

我无法正确关闭mysql,因为我不知道如何退出。键入'\e'对我没有帮助

x0fgdtte

x0fgdtte1#

我找到了答案:问题出在utf8\u set.cnf文件中。正确答案是:

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

我可以通过键入“exit”关闭mysql控制台。

相关问题