flasklogin-tutorial icon indicating copy to clipboard operation
flasklogin-tutorial copied to clipboard

Database

Open WanderingCoder-Omen opened this issue 5 years ago • 1 comments

Hi I believe you're using a MySQL db in this example. Can you please tell us how to setup the database ?

WanderingCoder-Omen avatar Jan 27 '20 10:01 WanderingCoder-Omen

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

plusangel avatar Jan 14 '21 16:01 plusangel