Cent_OS安装
# MySQL installation
wget http://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
yum localinstall mysql80-community-release-el7-1.noarch.rpm
yum repolist enabled | grep "mysql.*-community.*"
yum -y install mysql-community-server mysql-community-devel
## startup
systemctl enable mysqld
systemctl daemon-reload
service mysqld start
## password
grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
set password = 'xxx';Ubuntu安装
# ubuntu server - 更新软件源
sudo apt-get update
# ubuntu server - 安装mysql
sudo apt-get install mysql-server
# 其它操作系统可参考官网下载安装
# 重启服务
service mysql restart
# 用户登陆
mysql -u root -pMySQL操作
# 更改密码
use mysql;
update user set authentication_string=password("hello_django") where user="root";
flush privileges;
# 如果更改失败
# sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
# skip-grant-tables
# 配置使用
create database hello_django;
use hello_djangoDjango设置
pip install mysqlclientDATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'hello_django',
'USER': 'root',
'PASSWORD': 'hello_django',
'HOST': 'localhost',
'PORT': '3306',
}
}相对还是较常用
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。