12345678910111213
"""1.管理员连接数据库>: mysql -uroot -proot2.创建数据库>: create database luffy default charset=utf8;3.查看用户>: select user,host,password from mysql.user;# 5.7往后的版本>: select user,host,authentication_string from mysql.user;"""
1234567891011121314151617
"""设置权限账号密码# 授权账号命令:grant 权限(create, update) on 库.表 to '账号'@'host' identified by '密码'1.配置任意ip都可以连入数据库的账户>: grant all privileges on luffy.* to 'luffy'@'%' identified by 'Luffy123?';2.由于数据库版本的问题,可能本地还连接不上,就给本地用户单独配置>: grant all privileges on luffy.* to 'luffy'@'localhost' identified by 'Luffy123?';3.刷新一下权限>: flush privileges;只能操作luffy数据库的账户账号:luffy密码:Luffy123?"""
123456789101112
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'luffy', 'USER': 'luffy', 'PASSWORD': 'Luffy123?', 'HOST': 'localhost', 'PORT': 3306 }}import pymysqlpymysql.install_as_MySQLdb()
posted on 2020-12-04 10:40 Plyc 阅读(114) 评论(0) 编辑 收藏 举报