Skip to content

Commit

Permalink
#367 Fix MySQL charset (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmacko47 authored Apr 10, 2021
1 parent 92c707a commit 52bd412
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,10 @@ You need the following packages installed

#### 2.1.1. MySQL Configuration

Make sure your database has configured UTF-8 charset with correct collation:
Make sure your database has configured correct UTF-8 charset with full 4-byte support and with
correct collation:

mysql> alter database {database} character set utf8 collate utf8_general_ci;
mysql> alter database {database} character set utf8mb4 collate utf8mb4_general_ci;

Where `{database}` is your database name. You must alter database charset before creating any
tables, otherwise they will keep the old charset.
Expand Down
1 change: 1 addition & 0 deletions chcemvediet/settings/server_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
u'default': {
u'ENGINE': u'django.db.backends.mysql',
u'CONN_MAX_AGE': 60,
u'OPTIONS': {'charset': 'utf8mb4'},
# Filled in 'configured.py'
u'NAME': u'',
u'USER': u'',
Expand Down
1 change: 1 addition & 0 deletions chcemvediet/settings/server_dev_no_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
u'default': {
u'ENGINE': u'django.db.backends.mysql',
u'CONN_MAX_AGE': 60,
u'OPTIONS': {'charset': 'utf8mb4'},
# Filled in 'configured.py'
u'NAME': u'',
u'USER': u'',
Expand Down
1 change: 1 addition & 0 deletions chcemvediet/settings/server_prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
u'default': {
u'ENGINE': u'django.db.backends.mysql',
u'CONN_MAX_AGE': 60,
u'OPTIONS': {'charset': 'utf8mb4'},
# Filled in 'configured.py'
u'NAME': u'',
u'USER': u'',
Expand Down
7 changes: 6 additions & 1 deletion misc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN \
libssl-dev \
cron \
git \
vim \
# Dependencies
apache2 \
mysql-server \
Expand Down Expand Up @@ -41,7 +42,7 @@ RUN \
/etc/init.d/mysql start && \
printf "%s\n" \
"create database chcemvediet;" \
"alter database chcemvediet character set utf8 collate utf8_general_ci;" \
"alter database chcemvediet character set utf8mb4 collate utf8mb4_general_ci;" \
"grant all privileges on chcemvediet.* to chcemvediet@localhost identified by 'nbusr123';" \
| mysql && \
:
Expand Down Expand Up @@ -132,6 +133,10 @@ RUN \
"" \
# Google Custom Search API key (default)
"" \
# Google reCaptcha public key (default)
"" \
# Google reCaptcha private key (default)
"" \
# Load datasheets / Neighbourhood dummy was omitted / Delete it?
"y" \
# Load datasheets / Municipality dummy was omitted / Delete it?
Expand Down

0 comments on commit 52bd412

Please sign in to comment.