Arch Linux, standard kernel 5.16.3, MariaDB v10.6.5.
I try to start MariaDB, and it fails with
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (111)
systemctl status mariadb
gives me
Jan 28 20:13:13 gazelle mariadbd[2915]: 2022-01-28 20:13:13 0 [Note] InnoDB: Buffer pool(s) load completed at 220128 20:13:13
Jan 28 20:13:13 gazelle mariadbd[2915]: 2022-01-28 20:13:13 0 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
Jan 28 20:13:13 gazelle mariadbd[2915]: 2022-01-28 20:13:13 0 [Note] Server socket created on IP: '0.0.0.0'.
Jan 28 20:13:13 gazelle mariadbd[2915]: 2022-01-28 20:13:13 0 [Note] Server socket created on IP: '::'.
Jan 28 20:13:13 gazelle mariadbd[2915]: 2022-01-28 20:13:13 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.db' doesn't exist
Jan 28 20:13:13 gazelle mariadbd[2915]: 2022-01-28 20:13:13 0 [ERROR] Aborting
Jan 28 20:13:13 gazelle mariadbd[2915]: Warning: Memory not freed: 280
Jan 28 20:13:13 gazelle systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jan 28 20:13:13 gazelle systemd[1]: mariadb.service: Failed with result 'exit-code'.
Jan 28 20:13:13 gazelle systemd[1]: Failed to start MariaDB 10.6.5 database server.
So okay, I can't connect because the server isn't starting up. But even when it did start --- it did start on a few occasions, I would still get this error. I looked in /run/mysqld
, and mysqld.sock
is there, with 777
permissions, and it's owned by the mysql
user. I've also made sure that /var/lib/mysql
and everything underneath it is owned by mysql
Here's /etc/my.cnf
#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
[mysqld]
socket = /run/mysqld/mysqld.sock
[client]
socket = /run/mysqld/mysqld.sock
#
# include *.cnf from the config directory
#
!includedir /etc/my.cnf.d
What are the next possible steps? I've scoured the 'net, and nothing seems to help.
When initializing the database, mysql_install_db
Whether the datadir directory is specified during dB. It is recommended to use my.cnf
Specify the datadir directory in the CNF configuration file
Okay, so Paul T's comment
Curious about the two missing tables causing errors. Did the install not go smoothly, maybe reinstall?
was the clue. Looked at the Arch wiki, and I forgot to run mariadb-install-db
. Should've RTFM.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.