flasklogin-tutorial
flasklogin-tutorial copied to clipboard
Database
Hi I believe you're using a MySQL db in this example. Can you please tell us how to setup the database ?
Let's assume that you use Ubuntu 18.
First, you need to install MySQL. Please follow that tutorial "How To Install MySQL on Ubuntu 18.04", it's very decent.
Then you need to connect to MySQL using a command like (assuming that you have adjusted User Authentication and Privileges):
and create the new empty database like that:
mysql -u username -p
Then install PyMySQL using pip.
CREATE DATABASE dbname;
Then it's time to set the connection string for flask-SQLAlchemy in the .env file that will look like:
SQLALCHEMY_DATABASE_URI=mysql+pymysql://root:password@localhost/db_users