2_python连接MariaDB错误
16lz
2021-01-22
-
- 环境
- 问题描述
- 报错信息
- 验证步骤
- 解决方法
环境
- OS: Archlinux
- Python: python27, django 1.7.11
- Mysql: Mariadb
问题描述
在django中连接Mariadb出错
报错信息
django.db.utils.OperationalError: (2002, 'Can\'t connect to local MySQL server through socket \'/run/mysqld/mysqld.sock\' (2 "No such file or directory")')
验证步骤
- 主要提示信息如下,之前有过类似的
connection ferused
,验证了下用户名密码就可以了, - 那么新的问题来了,解决完上面的问题之后出现这样的问题
解决方法
在排除了用户名和密码之后,根据提示说是没有找到相关socket文件,那么下面这条命令会出现什么呢。
ln -s /dev/shm/mysqld.sock /run/mysqld/mysqld.sock
, 没错,可以同步数据库了
➜ simplecmdb python manage.py migrate
Operations to perform:
Apply all migrations: admin, contenttypes, hostinfo, auth, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying hostinfo.0001_initial... OK
Applying hostinfo.0002_auto_20170331_1038... OK
Applying sessions.0001_initial... OK
更多相关文章
- 在CentOS 6.3 64bit上搭建python高性能框架gevent开发环境
- python环境配置问题及解决办法集锦
- Windows7下搭建Django运行环境
- Python 3基础教程1-环境安装和运行环境
- Python2.7.13,Anaconda环境下Opencv2编程bug不会修改,求教
- 在windows上安装scikit-learn开发环境
- cocos2d-3.2+python+NDK搭建游戏开发环境
- 环境变量的安装以及python cahrm的安装以及常用快捷键的使用
- ubuntu下eclipse pydev 离线 环境搭建 及相关问题解决