赞
踩
本教程主要用于ubuntu18中安装mysql8.0
(1) 安装依赖包
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mydatabase',
'USER': 'mydatabaseuser',
'PASSWORD': 'mypassword',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
注:修改: ‘HOST’: ‘localhost’, ‘PORT’: ‘3306’,
create user 'username'@'localhost' identified by 'new password'
#对mysql8.0以下使用的
alter user 'username'@'localhost' identified by 'new password'
#对mysql8.0.26使用以下代码,不然会出错
#因为mysql8.0.26默认是caching_sha2_password,要修改成mysql_native_password
create user 'user_name'@'localhost' identified with mysql_native_password by 'newpassword';
#如果已经创建好的,修改方式如下
alter user 'user_name'@'localhost' identified with mysql_native_password by 'newpassword';
#查看编码方式
use mysql;
select user,plugin from user where user='schoolAdminSystem_db';
grant all privileges on database_name.* to username@localhost;
flush privileges;
create database database_name default charset=utf8 default collate utf8_unicode_ci;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。