Simple Java project with Driver method and DAO.
$ sudo apt install mysql-server
$ mysql -p
Once you have the MySQL CLI open enter the following line to create a new user:
CREATE USER 'sqluser'@'localhost' IDENTIFIED BY 'sqluserpw';
If you receive an error, try dropping the user in case it already exists:
DROP USER 'sqluser'@'localhost';
CREATE DATABASE covid;
USE covid;
If you attempt to run this repository's Main.java file, you will likely receive an error stating that the 'sqluser' database user does not have permissions. Enter the following lines in the MySQL CLI:
GRANT USAGE ON *.* TO sqluser@localhost;
GRANT ALL PRIVILEGES ON covid.* TO sqluser@localhost;
- Make sure you have the Java JDK installed.
- If you are having issues running this repository in Visual Studio Code, follow the steps provided in this article.
Checkout the NYT's Covid dataset with:
git clone https://github.com/nytimes/covid-19-data.git
Modify the populateX() methods in MySqlDao to point to the appropriate csv files.
Query your new database tables with MySQL CLI or Workbench.
Ctrl+F "TODO" in MySqlDao.