mysql的设置
创建数据库:create database website character set utf8;
设置了字符串为utf8,以保证后面不出错
import pymysql
pymysql.install_as_MySQLdb()
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'website',
'USER': 'root',
'PASSWORD': '123456',
'HOST': '192.168.123.124',
'PORT': '3306',
}
}
遇到问题
[mysql"Access denied for user'root'@'IP地址'"问题]
解决方法是给予权限:
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
然后成功将本地数据上传到数据库