安装mysql sudo pacman -S mysql 初始化语句 sudo mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql 设置开机自启 sudo systemctl enable mysqld.service 启动mysql服务 sudo systemctl start mysqld.service 查看mysql服务状态 systemctl status mysqld.service 输出如下 ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2019-08-01 22:03:15 CST; 34s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 11218 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0