![每次笔记本电脑重新启动时,MySQL 都需要在终端中重新启动。14.04.2 LTS](https://linux22.com/image/1051220/%E6%AF%8F%E6%AC%A1%E7%AC%94%E8%AE%B0%E6%9C%AC%E7%94%B5%E8%84%91%E9%87%8D%E6%96%B0%E5%90%AF%E5%8A%A8%E6%97%B6%EF%BC%8CMySQL%20%E9%83%BD%E9%9C%80%E8%A6%81%E5%9C%A8%E7%BB%88%E7%AB%AF%E4%B8%AD%E9%87%8D%E6%96%B0%E5%90%AF%E5%8A%A8%E3%80%8214.04.2%20LTS.png)
几周前我安装了 MySQL。现在的问题是每次重启笔记本电脑时,我还必须通过以下方式在终端中手动重启 MySQL:
sudo service mysql restart
执行该命令行之前我得到的错误(如下:)
$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
$ /usr/bin/mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
答案1
输入此命令以使你的 mysql 自动启动:
sudo update-rc.d mysql defaults