How to import SQL file to MySQL using Command Line ?
Hi Guys,
In this tutorial,I will learn you how to import sql file to mysql using command line. you can easy and simply import database.
you can import sql file to mysql using command line and without command.
Step 1 : Create Database
First step, Open XAMPP and start Apache Server and MySQL Database.you can need to Mysql database. then open phpmyadmin and create a new database.
I have create a demo database.
Step 2 : Using Command + Without Command
Solution 1 : Using Command you can open command prompt then open directory xampp/mysql/bin/
then follow this command
Syntax :
mysql -u username -p database_name < file.SQL
username = Your MySQL username.
database_name = Database name in which you want to import.
file.sql = SQL file name.
Example :
mysql -u root -p demo < demo.sql
I am importing demo.sql file in demo Database.
Solution 2 : Without Command
In this step without command import to database in phpmyadmin.
1. first click to import
2. Then choose file Click
3. choose the Sql file
4. Last go button click
5. create to database
It will help you...
- How to Increase max_connections in MySQL?
- How to Install the PHP PDO MySQL Extension on Ubuntu 22.04?
- How to Install PHP MySQL on Linux Ubuntu?
- How to Install LEMP Stack Nginx, MySQL, PHP on Ubuntu?
- How to Change MySQL Root User Password Ubuntu?
- PHP 8 MySQL Form Validation Example
- How to Select First Row Only in PHP MySQL?
- How To Backup MySQL Database Using PHP Example