尝试在rspbian Stretch上安装MySQL时遇到很多麻烦,
所以最后我删除了所有带有sql的内容,然后又安装了mysql-server
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install mysql-server mysql-client
但是现在当我尝试以root身份登录时出现此错误
pi@raspberrypi:~ $ sudo mysql --user=root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
当我尝试启动服务器时,出现此错误:
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
日志中的错误是:
● mariadb.service - MariaDB 10.1.38 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-05-27 13:42:56 CET; 19s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 4740 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 4663 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 4657 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 4655 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 4740 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"
mai 27 13:42:54 raspberrypi systemd[1]: Starting MariaDB 10.1.38 database server...
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Note] /usr/sbin/mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 4740 ...
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Warning] Can't create test file /var/lib/mysql/raspberrypi.lower-test
mai 27 13:42:56 raspberrypi mysqld[4740]: [97B blob data]
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [ERROR] Aborting
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
mai 27 13:42:56 raspberrypi systemd[1]: Failed to start MariaDB 10.1.38 database server.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Unit entered failed state.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Failed with result 'exit-code'.
和:
mai 27 13:42:22 raspberrypi kernel: Voltage normalised (0x00000000)
mai 27 13:42:50 raspberrypi polkitd(authority=local)[810]: Registered Authentica
mai 27 13:42:54 raspberrypi polkitd(authority=local)[810]: Operator of unix-sess
mai 27 13:42:54 raspberrypi systemd[1]: Starting MariaDB 10.1.38 database server
-- Subject: L'unité (unit) mariadb.service a commencé à démarrer
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a commencé à démarrer.
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Note]
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Warnin
mai 27 13:42:56 raspberrypi mysqld[4740]: [97B blob data]
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [ERROR]
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Main process exited, co
mai 27 13:42:56 raspberrypi systemd[1]: Failed to start MariaDB 10.1.38 database
-- Subject: L'unité (unit) mariadb.service a échoué
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a échoué, avec le résultat failed.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Unit entered failed sta
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Failed with result 'exi
mai 27 13:42:56 raspberrypi polkitd(authority=local)[810]: Unregistered Authenti
lines 1835-1857/1857 (END)
mai 27 13:42:22 raspberrypi kernel: Voltage normalised (0x00000000)
mai 27 13:42:50 raspberrypi polkitd(authority=local)[810]: Registered Authentication Agent for unix-process:4643:531066 (sy
mai 27 13:42:54 raspberrypi polkitd(authority=local)[810]: Operator of unix-session:c1 successfully authenticated as unix-u
mai 27 13:42:54 raspberrypi systemd[1]: Starting MariaDB 10.1.38 database server...
-- Subject: L'unité (unit) mariadb.service a commencé à démarrer
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a commencé à démarrer.
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Note] /usr/sbin/mysqld (mysqld 10.1.38-MariaDB-0+
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Warning] Can't create test file /var/lib/mysql/ra
mai 27 13:42:56 raspberrypi mysqld[4740]: [97B blob data]
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [ERROR] Aborting
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
mai 27 13:42:56 raspberrypi systemd[1]: Failed to start MariaDB 10.1.38 database server.
-- Subject: L'unité (unit) mariadb.service a échoué
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a échoué, avec le résultat failed.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Unit entered failed state.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Failed with result 'exit-code'.
mai 27 13:42:56 raspberrypi polkitd(authority=local)[810]: Unregistered Authentication Agent for unix-process:4643:531066 (
lines 1835-1857/1857 (END)
mai 27 13:42:22 raspberrypi kernel: Voltage normalised (0x00000000)
mai 27 13:42:50 raspberrypi polkitd(authority=local)[810]: Registered Authentication Agent for unix-process:4643:531066 (system bus name :1.49 [/usr/bin/pkttyagent --notify-fd 5 --fallback], objec
mai 27 13:42:54 raspberrypi polkitd(authority=local)[810]: Operator of unix-session:c1 successfully authenticated as unix-user:pi to gain TEMPORARY authorization for action org.freedesktop.systemd
mai 27 13:42:54 raspberrypi systemd[1]: Starting MariaDB 10.1.38 database server...
-- Subject: L'unité (unit) mariadb.service a commencé à démarrer
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a commencé à démarrer.
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Note] /usr/sbin/mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 4740 ...
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Warning] Can't create test file /var/lib/mysql/raspberrypi.lower-test
mai 27 13:42:56 raspberrypi mysqld[4740]: [97B blob data]
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [ERROR] Aborting
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
mai 27 13:42:56 raspberrypi systemd[1]: Failed to start MariaDB 10.1.38 database server.
-- Subject: L'unité (unit) mariadb.service a échoué
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a échoué, avec le résultat failed.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Unit entered failed state.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Failed with result 'exit-code'.
mai 27 13:42:56 raspberrypi polkitd(authority=local)[810]: Unregistered Authentication Agent for unix-process:4643:531066 (system bus name :1.49, object path /org/freedesktop/PolicyKit1/Authentica
lines 1835-1857/1857 (END)
mai 27 13:42:22 raspberrypi kernel: Voltage normalised (0x00000000)
mai 27 13:42:50 raspberrypi polkitd(authority=local)[810]: Registered Authentication Agent for unix-process:4643:531066 (system bus name :1.49 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/Auth
mai 27 13:42:54 raspberrypi polkitd(authority=local)[810]: Operator of unix-session:c1 successfully authenticated as unix-user:pi to gain TEMPORARY authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.5
mai 27 13:42:54 raspberrypi systemd[1]: Starting MariaDB 10.1.38 database server...
-- Subject: L'unité (unit) mariadb.service a commencé à démarrer
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a commencé à démarrer.
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Note] /usr/sbin/mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 4740 ...
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Warning] Can't create test file /var/lib/mysql/raspberrypi.lower-test
mai 27 13:42:56 raspberrypi mysqld[4740]: [97B blob data]
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [ERROR] Aborting
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
mai 27 13:42:56 raspberrypi systemd[1]: Failed to start MariaDB 10.1.38 database server.
-- Subject: L'unité (unit) mariadb.service a échoué
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a échoué, avec le résultat failed.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Unit entered failed state.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Failed with result 'exit-code'.
mai 27 13:42:56 raspberrypi polkitd(authority=local)[810]: Unregistered Authentication Agent for unix-process:4643:531066 (system bus name :1.49, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale fr_FR.UTF-8) (disconn
lines 1835-1857/1857 (END)
mai 27 13:42:22 raspberrypi kernel: Voltage normalised (0x00000000)
mai 27 13:42:50 raspberrypi polkitd(authority=local)[810]: Registered Authentication Agent for unix-process:4643:531066 (system bus name :1.49 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale fr_F
mai 27 13:42:54 raspberrypi polkitd(authority=local)[810]: Operator of unix-session:c1 successfully authenticated as unix-user:pi to gain TEMPORARY authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.50 [systemctl start mysql] (o
mai 27 13:42:54 raspberrypi systemd[1]: Starting MariaDB 10.1.38 database server...
-- Subject: L'unité (unit) mariadb.service a commencé à démarrer
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a commencé à démarrer.
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Note] /usr/sbin/mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 4740 ...
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Warning] Can't create test file /var/lib/mysql/raspberrypi.lower-test
mai 27 13:42:56 raspberrypi mysqld[4740]: [97B blob data]
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [ERROR] Aborting
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
mai 27 13:42:56 raspberrypi systemd[1]: Failed to start MariaDB 10.1.38 database server.
-- Subject: L'unité (unit) mariadb.service a échoué
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a échoué, avec le résultat failed.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Unit entered failed state.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Failed with result 'exit-code'.
mai 27 13:42:56 raspberrypi polkitd(authority=local)[810]: Unregistered Authentication Agent for unix-process:4643:531066 (system bus name :1.49, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale fr_FR.UTF-8) (disconnected from bus)
lines 1835-1857/1857 (END)
mai 27 13:42:22 raspberrypi kernel: Voltage normalised (0x00000000)
mai 27 13:42:50 raspberrypi polkitd(authority=local)[810]: Registered Authentication Agent for unix-process:4643:531066 (system bus name :1.49 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale fr_FR.UTF-8)
mai 27 13:42:54 raspberrypi polkitd(authority=local)[810]: Operator of unix-session:c1 successfully authenticated as unix-user:pi to gain TEMPORARY authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.50 [systemctl start mysql] (owned by unix-user:pi)
mai 27 13:42:54 raspberrypi systemd[1]: Starting MariaDB 10.1.38 database server...
-- Subject: L'unité (unit) mariadb.service a commencé à démarrer
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a commencé à démarrer.
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Note] /usr/sbin/mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 4740 ...
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [Warning] Can't create test file /var/lib/mysql/raspberrypi.lower-test
mai 27 13:42:56 raspberrypi mysqld[4740]: [97B blob data]
mai 27 13:42:56 raspberrypi mysqld[4740]: 2019-05-27 13:42:56 1995611952 [ERROR] Aborting
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
mai 27 13:42:56 raspberrypi systemd[1]: Failed to start MariaDB 10.1.38 database server.
-- Subject: L'unité (unit) mariadb.service a échoué
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) mariadb.service a échoué, avec le résultat failed.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Unit entered failed state.
mai 27 13:42:56 raspberrypi systemd[1]: mariadb.service: Failed with result 'exit-code'.
mai 27 13:42:56 raspberrypi polkitd(authority=local)[810]: Unregistered Authentication Agent for unix-process:4643:531066 (system bus name :1.49, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale fr_FR.UTF-8) (disconnected from bus)
lines 1835-1857/1857 (END)
我该如何解决这个问题?知道我已经尝试了无数种解决方案,但都没有成功
答案 0 :(得分:0)
对此片段进行猜测
ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/r
mysql用户可能没有权限更新/创建指向/var/<something>
的任何文件夹。