无法通过socket'/run/mysqld/mysqld.sock'连接本地MySql服务器(2)

2021-11-17 00:00:00 mysql mysql-error-1064 archlinux

我使用的是 Arch Linux.我已经通过 aurget 安装了 mysql.然后,当我尝试创建一些数据库时,我遇到了错误:Can't connect to local MySql server through socket '/run/mysqld/mysqld.sock' (2)" 应该怎么做我这样做是为了解决我的问题?

I'm using Arch Linux. I've installed mysql by aurget. Then when I'm trying to make some data base I face the error: "Can't connect to local MySql server through socket '/run/mysqld/mysqld.sock' (2)" What should I do to resolve my problem?

推荐答案

在 Archlinux 中,服务在安装后未启用或自动启动.根据ArchWiki,安装软件包后,您需要运行(以root身份):

In Archlinux, services are not enabled or started automatically after installation. According to ArchWiki, after installing the package you need to run (as root):

mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
systemctl enable mysql.service
systemctl start mysql.service

相关文章