MySQL(MariaDB)无法启动


15

我在64位安装上运行Arch Linux 4.8.4-1。我通过安装了MariaDB pacman。当我尝试从开始时systemctl start mysqld,它给了我

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

的输出systemctl status mariadb.service

● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2016-11-02 16:55:12 IST; 3min 6s ago
  Process: 5123 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
  Process: 5070 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set
  Process: 5067 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 5123 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"

Nov 02 16:55:11 pranav-laptop systemd[1]: Starting MariaDB database server...
Nov 02 16:55:12 pranav-laptop mysqld[5123]: 2016-11-02 16:55:12 140082509282496 [Note] /usr/sbin/mysqld (mysqld 10.1.18-MariaDB) starting as process 5
Nov 02 16:55:12 pranav-laptop mysqld[5123]: 2016-11-02 16:55:12 140082509282496 [Warning] Can't create test file /var/lib/mysql/pranav-laptop.lower-te
Nov 02 16:55:12 pranav-laptop mysqld[5123]: [90B blob data]
Nov 02 16:55:12 pranav-laptop systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Nov 02 16:55:12 pranav-laptop systemd[1]: Failed to start MariaDB database server.
Nov 02 16:55:12 pranav-laptop systemd[1]: mariadb.service: Unit entered failed state.
Nov 02 16:55:12 pranav-laptop systemd[1]: mariadb.service: Failed with result 'exit-code'.

如果我需要发布其他任何内容,请告诉我...

更新:尝试了JérémyMunoz的评论后,mysql仍然无法启动,但是我得到了不同的结果systemctl status mariadb.service

● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2016-11-02 21:03:24 IST; 4min 7s ago
  Process: 14350 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
  Process: 14296 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl se
  Process: 14294 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 14350 (code=exited, status=1/FAILURE)

Nov 02 21:03:24 pranav-laptop mysqld[14350]: 2016-11-02 21:03:24 140412958252224 [ERROR] Could not open mysql.plugin table. Some plugins may be not lo
Nov 02 21:03:24 pranav-laptop mysqld[14350]: 2016-11-02 21:03:24 140412958235392 [Warning] Failed to load slave replication state from table mysql.gti
Nov 02 21:03:24 pranav-laptop mysqld[14350]: 2016-11-02 21:03:24 140412362684160 [Note] InnoDB: Dumping buffer pool(s) not yet started
Nov 02 21:03:24 pranav-laptop mysqld[14350]: 2016-11-02 21:03:24 140412958252224 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' d
Nov 02 21:03:24 pranav-laptop mysqld[14350]: 2016-11-02 21:03:24 140412958252224 [Note] Server socket created on IP: '::'.
Nov 02 21:03:24 pranav-laptop mysqld[14350]: 2016-11-02 21:03:24 140412958252224 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mys
Nov 02 21:03:24 pranav-laptop systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Nov 02 21:03:24 pranav-laptop systemd[1]: Failed to start MariaDB database server.
Nov 02 21:03:24 pranav-laptop systemd[1]: mariadb.service: Unit entered failed state.
Nov 02 21:03:24 pranav-laptop systemd[1]: mariadb.service: Failed with result 'exit-code'.

更新:运行后mysql_install_db,出现此错误:

FATAL ERROR: Could not find ./bin/my_print_defaults

If you compiled from source, you need to either run 'make install' to
copy the software into the correct location ready for operation.
If you don't want to do a full install, you can use the --srcddir
option to only install the mysql database and privilege tables

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

The latest information about mysql_install_db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db

/etc/mysql/my.cnf


你似乎缺少权限到/ var / lib中/ MySQL的/
安德鲁·史密斯

我应该设置哪些权限?
Pranav Nutalapati

chown -R mysql。在/ var / lib中/ MySQL的/
杰里米·穆尼奥斯

@JérémyMunoz我尝试了您的解决方案。它仍然没有开始。我用新错误更新了问题。
Pranav Nutalapati

请显示来自file的mysql / mariadb配置/etc/mysql/my.cnf
Mikhail Khirgiy '16

Answers:


20

如果您的数据库中没有任何真实数据,请清除中的全部/var/lib/mysql

之后,再次尝试运行命令mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql以初始化数据库目录。


这个答案的方法是什么?
kittygirl,

如果这不起作用,还有其他尝试吗?
moeiscool

@kittygirl嗨,这样做的目的是为了重新创建MySQL的数据结构,要么是因为它搞砸了,要么是因为它不存在。至少,这就是我的理解方式。
Pranav Nutalapati


1

我在注册的Ubuntu 18.04m软件包上遇到了同样的问题,似乎无法启动,否则...

我通过从此站点添加正确的软件包列表和签名来解决。

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.3/ubuntu bionic main'
sudo apt update
sudo apt install mariadb-server

等..


嗯,这很有趣...所以您在安装时遇到了问题?Linux认为它不是在真正安装时安装的?真的很奇怪...对我来说,最终发生的是我的设置过程未完成,所以我不得不手动执行此操作mysql_install_db
Pranav Nutalapati

这对我
有用

0

面临同样的问题。执行以下步骤后,此问题得到解决:

  1. 卸载mariadb maridb-server软件包
  2. 删除目录/ var / lib / mysql。
  3. 重新安装了Mariadb,Mariadb服务器软件包。
  4. systemct启动mariadb;systemctl启用mariadb

(问题解决了)。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.