In your code, you are trying to connect to a database (lines 2-7) before creating it (line 9).
Create the database in a terminal first. Then no need for lines 9 and 10.
Keep in mind that this is not a Rasa-related question, maybe consider StackOverflow for more general questions 