要在系统启动时自动启动MySQL服务,可以使用以下命令设置MySQL服务开机自启:
打开终端并登录到root用户。
使用以下命令启用MySQL服务自动启动:
systemctl enable mysql
systemctl start mysql
systemctl status mysql
如果MySQL服务已成功启动并设置为开机自启,您将看到类似以下内容的输出:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-10-12 12:00:00 UTC; 1h 30min ago