I have a form with an input file, I want the user to upload a sql file, read it with php and import it to my database
My form code is
<div class="form-row" >
<div class="form-group col-md-4">
<input type="file" accept=".sql" class="form-control" name="sql">
</div>
<div class="form-group col-md-4">
<button type="submit" formaction="upload_sql.php" style="margin-top:8%" class="btn btn-primary" name="upload_sql">Upload</button>
</div>
</div>
But I don't know how to import that file into my database, I tried with "mysql -u root -p database < file.sql"