Mysql in Ionic


How can I use MySQL database in ionic? Can I use it with ‘www’ folder included in the project?


No. You will have to write a web application that provides a API (best REST API) to your Ionic app.


How can I insert data in the MySQL database using Ionic app?


You can’t. you need a server to deal with mysql.


Can you please help me with this?


you cannot directly talk with MySQL in ionic, the recommended way is to use API.

think like this:
Server (has MySQL Database) <-------> REST API <------------> ionic app using http request/response

  1. Server, anything you want to call it,with mysql server inside of it.
  2. build a rest api inside your server, example (lumen/laravel/ or whatever you want for a rest api).
  3. make an ionic provider in your app project, use http
  4. you can use the result of that http response, whether you want it to display on the page or store it on a local storage on your device like sqlite.


Can you give me some resources for this?


I dont know your preferences, but here one for lumen or laravel

for using http response/request and providers in ionic 2 please check this

hope it helps you.


Thanks for these resources. I want to send data from ionic app to the server. Is there any way to do so?