老师好!
今天学到了5-3这一节,启动Django服务器,登录注册页面,这都正常。在提交注册信息时,出现数据库错误。
MySQL数据库本身没问题,通过Pycharm和Navicat连接都正常。
错误信息如下:
OperationalError at /admin/login/
(2002, “Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (111)”)
登录服务器查看数据库服务状态,有以下提示:
Nov 08 15:13:25 etopcc systemd[1]: Starting MySQL 8.0 database server…
Nov 08 15:13:25 etopcc mysql-check-socket[4521]: Socket file /var/lib/mysql/mysql.sock exists.
Nov 08 15:13:25 etopcc mysql-check-socket[4521]: No process is using /var/lib/mysql/mysql.sock, which means it is a garbage, so it will be removed automatically.
Nov 08 15:13:27 etopcc systemd[1]: Started MySQL 8.0 database server.
~