출처 : https://github.com/PyMySQL/mysqlclient-python
sudo yum install python-devel mysql-devel
# Red Hat / CentOS
Note on Python 3 : if you are using python3 then you need to install python3-dev using the following command :
sudo apt-get install python3-dev
# debian / Ubuntusudo yum install python3-devel
# Red Hat / CentOS
Install from PyPI
pip install mysqlclient
출처 http://vezi95.blogspot.kr/2016/06/django-mysql.html
데이터베이스 설정 변경 - project/settings.py
DATABASES 항목을 찾아서 다음과 같이 수정합니다.
DATABASES = {
'default':{
'ENGINE':'django.db.backends.mysql',
'NAME':'db1',
'USER':'user1',
'PASSWORD':'user1_pw',
'HOST':'mysqlhost.example.com',
'PORT':'3306',
}
}
데이터베이스에 적용 및 수퍼유저 생성
$ python manage.py migrate
$ python manage.py createsuperuser
mysql 데이터베이스 접속
$ mysql-u root -p (enter)
$ Enter password:
비밀번호 입력
---------------------------------------------------------------------------------------------
Install from PyPI
이 단계에서 에러가 남. "python setup.py egg_info" failed with error code 1
Install
sudo yum -y install mariadb-server mariadb
Start
sudo service mariadb start
Be sure that MySQL/MariaDB starts at boot:
sudo systemctl enable mariadb
Check
yourUser@yourServer:[~]: mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.44-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
Configuration
Reference: https://mariadb.com/blog/installing-mariadb-10-centos-7-rhel-7
MariaDB is shipped with a script to harden the system accordingly using a user dialog. It is highly recommended to use this script before creating and populating the databases. So, launch the following command:
yourUser@yourServer:[~]: mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
[...]
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
[...]
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
[...]
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
출처 : https://github.com/certsocietegenerale/FIR/wiki/Installation-on-CentOS-7
다시
yum install mysql-devel
pip install mysqlclient
'Django' 카테고리의 다른 글
Django로 앱 만드는 초기과정 (0) | 2018.01.18 |
---|---|
django model (0) | 2018.01.09 |
django project 생성시 만들어지는 파일 (0) | 2018.01.09 |
django 연습 예제 (0) | 2018.01.09 |
centos7 에다 django 설치 (0) | 2018.01.08 |