{"id":19522654,"url":"https://github.com/lintangwisesa/crud_flask_mysql","last_synced_at":"2025-10-29T16:10:49.773Z","repository":{"id":121862131,"uuid":"164026460","full_name":"LintangWisesa/CRUD_Flask_MySQL","owner":"LintangWisesa","description":"Basic CRUD with Python Flask \u0026 MySQL Database","archived":false,"fork":false,"pushed_at":"2019-05-02T02:51:53.000Z","size":8,"stargazers_count":16,"open_issues_count":0,"forks_count":23,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T10:37:33.512Z","etag":null,"topics":["flask","mysql","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LintangWisesa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-03T21:48:44.000Z","updated_at":"2024-12-15T17:57:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"cde83c6e-f257-4d85-a8ad-35a2edfd458a","html_url":"https://github.com/LintangWisesa/CRUD_Flask_MySQL","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LintangWisesa%2FCRUD_Flask_MySQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LintangWisesa%2FCRUD_Flask_MySQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LintangWisesa%2FCRUD_Flask_MySQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LintangWisesa%2FCRUD_Flask_MySQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LintangWisesa","download_url":"https://codeload.github.com/LintangWisesa/CRUD_Flask_MySQL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250967324,"owners_count":21515575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","mysql","python"],"created_at":"2024-11-11T00:40:11.095Z","updated_at":"2025-10-29T16:10:49.660Z","avatar_url":"https://github.com/LintangWisesa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![simplinnovation](https://4.bp.blogspot.com/-f7YxPyqHAzY/WJ6VnkvE0SI/AAAAAAAADTQ/0tDQPTrVrtMAFT-q-1-3ktUQT5Il9FGdQCLcB/s350/simpLINnovation1a.png)\n\n# Basic CRUD: Flask \u0026 MySQL\n\n1. Activate __MySQL__ server:\n    \n    ```bash\n    $ cd C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\n    $ mysql.exe -u \u003cusername\u003e -p\u003cpassword\u003e\n    $ mysql -u \u003cusername\u003e -p\n    ```\n    \n    On my case:\n    \n    ```bash\n    $ mysql.exe -u lintang -p12345\n    $ mysql -u lintang -p   \n    ```\n\n#\n\n2. Create a database \u0026 table on MySQL. I'll use a database called __\"lin_flask\"__ \u0026 a table called __\"users\"__:\n    \n    ```bash\n    mysql\u003e  CREATE DATABASE lin_flask;\n    mysql\u003e  USE lin_flask;\n    mysql\u003e  CREATE TABLE users (\n                id int auto_increment,\n                name varchar(100) not null,\n                age tinyint,\n                primary key (id)\n            );\n    ``` \n\n#\n\n3. Clone this repo. Edit __database.yaml__ file according to your database configuration, then install all the packages needed. In this project I'm using __flask__, __flask_cors__ \u0026 __flask_mysqldb__:\n    ```bash\n    $ git clone https://github.com/LintangWisesa/CRUD_Flask_MySQL.git\n    $ cd CRUD_Flask_MySQL\n    ```\n    Install dependencies:\n\n    ```bash\n    $ pip install flask flask_cors flask_mysqldb\n    $ py -m pip install flask flask_cors flask_mysqldb\n    ```\n\n#\n\n4. Run the server file. Make sure your MySQL server is still running. Your application server will run locally at __*http://localhost:5000/*__ :\n    ```bash\n    $ py app.py\n    $ python app.py\n    $ python3 app.py\n    ```\n\n#\n\n5. Give a request to the server. You can use __Postman__ app:\n    \n    __See the opening screen (*home.html*)__\n    ```bash\n    GET /\n    ```\n\n    __Post a data to database:__ \n    ```bash\n    POST /data\n    body request: {name:\"x\", age:\"y\"}\n    ```\n    __Get all data \u0026 specific data by id:__\n    ```bash\n    GET /data\n    GET /data/{:id}\n    ```\n    __Update a data by id__:\n    ```bash\n    PUT /data/{:id}\n    body request: {name:\"x\", age:\"y\"}\n    ```\n    __Delete a data by id:__\n    ```bash\n    DELETE /data/{:id}\n    ```\n\n#\n\n6. Enjoy your code! 😎👌\n\n## See also:\n\n- [Basic CRUD: Flask \u0026 MySQL](https://github.com/LintangWisesa/CRUD_Flask_MySQL)\n- [Basic CRUD: Flask \u0026 PostgreSQL](https://github.com/LintangWisesa/CRUD_Flask_PostgreSQL)\n- [Basic CRUD: Flask \u0026 MongoDB](https://github.com/LintangWisesa/CRUD_Flask_MongoDB)\n\n#\n\n#### Lintang Wisesa :love_letter: _lintangwisesa@ymail.com_\n\n[Facebook](https://www.facebook.com/lintangbagus) | \n[Twitter](https://twitter.com/Lintang_Wisesa) |\n[Google+](https://plus.google.com/u/0/+LintangWisesa1) |\n[Youtube](https://www.youtube.com/user/lintangbagus) | \n:octocat: [GitHub](https://github.com/LintangWisesa) |\n[Hackster](https://www.hackster.io/lintangwisesa)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flintangwisesa%2Fcrud_flask_mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flintangwisesa%2Fcrud_flask_mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flintangwisesa%2Fcrud_flask_mysql/lists"}