几周前我安装了 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