swsnu / swpp2019-team7

1 stars 1 forks source link

switch to MySql #51

Closed lookdeceline closed 4 years ago

lookdeceline commented 5 years ago

sql lite ==> my sql

don't forget about it!

jaehunjung1 commented 5 years ago

Successfully migrated to MySQL. Here is tutorial:

Mac OS

  1. Install MySql by brew install mysql

  2. Install mysqlclient by pip install mysqlclient

  3. Start mysql service by brew services start mysql (to stop homebrew mysql service, you can brew services stop mysql)

  4. Login to mysql by mysql -u root

  5. Create Database in mysql by CREATE DATABASE pillbox;
    CREATE USER jay IDENTIFIED BY 'pillbox1!'; <- should exactly be jay / pillbox1!
    GRANT ALL PRIVILEGES ON pillbox.* TO jay;
    FLUSH PRIVILEGES exit

  6. Now our mysql is all set. Now, we should migrate Django DB to MySQL. Type python manage.py makemigrations appname for each app <- This should be done before any migrations!!! Type python manage.py migrate
    Type python manage.py runserver to check if it runs well.

Linux (Ubuntu)

  1. Ubuntu는 brew install mysql 대신 sudo apt-get install mysql-server 등등으로 대체하면 됨 ^^
jinsun-yoo commented 4 years ago

Need to consistantly refer

jinsun-yoo commented 4 years ago

Linux needs to do additional sudo apt-get install libmysqlclient-dev between 1 and 2

jinsun-yoo commented 4 years ago

For linux, No.3 is sudo systemctl start mysql

peterhyun commented 4 years ago

In case of encoding error

use {databaseName}
alter table {table name} convert to character set utf8mb4;