Permalink
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
CoNekT/docs/connect_mysql.md
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
35 lines (18 sloc)
1.14 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Setting up MySQL/MariaDB for Planet | |
Either use the libmysql library which needs to be installed on the machine using | |
sudo apt-get install python3-dev libmysqlclient-dev | |
and within the virtualenvironment | |
pip install mysqlclient | |
In the config file the connection needs to be set up using : | |
SQLALCHEMY_DATABASE_URI = 'mysql://user:pass@ip_address/database' | |
In case the **libraries cannot be installed** on the machine a pure python mysql connector can be used. Install this within | |
the virtual environment. | |
pip install PyMySQL | |
In the config file the connection needs to be set up using : | |
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://user:pass@ip_address/database' | |
## Setting up the database using the MySQL CLI | |
First create a database. The character set and collate are important as sqlalchemy-migrate doesn't work with utf8mb4 (the | |
default). | |
CREATE DATABASE planet_db_01 CHARACTER SET latin1 COLLATE latin1_general_ci; | |
Give permissions to a user (planet_dev in this example) to access the database: | |
GRANT INDEX, CREATE, DROP, SELECT, UPDATE, DELETE, ALTER, EXECUTE, INSERT on planet_db_01.* TO planet_dev@localhost; |