How to Import Database Mysql Command Line Windows Xampp

How to Import Database Mysql Command Line Windows Xampp

To import database from the SQL dump file in mysql using the command line or cmd with Windows XAMPP, Just type C:\xampp\mysql\bin>mysql -u username -p database_name < path_to_mysql_file.sql command on Windows command prompt and press enter, it will import db from sql dump file into your MySQL XAMPP server in Windows.

XAMPP Server must be installed in your Windows system, if you haven’t installed it yet, please read this :- How to Install XAMPP in Windows.

How to Import Database from sql dump file in MySQL using Command Line Windows Xampp

Here are steps for importing the database in MySQL using Windows command prompt or cmd xampp:

Step 1: Open the Command Prompt or CMD

To start the Windows command prompt or line, click the Windows Start menu, type CMD and press Enter.

Step 2: Navigate to the MySQL bin directory

Now navigate to the bin directory of the MySQL server in xampp directory, Use cd C:\xampp\mysql\bin command on windows cmd or command prompt and press enter:

cd C:\xampp\mysql\bin

The location of the MySQL bin directory may vary depending on where you have installed XAMPP on your system. By default, the path to the MySQL bin directory is ‘C:\xampp\mysql\bin’.

Step 3: Import the database or SQL File in MySQL using Windows Command Prompt Xampp Server

Importing Database from SQL Dump File into MySQL xampp server, simply type C:\xampp\mysql\bin>mysql -u username -p database_name < path_to_mysql_file.sql command on the windows command line or CMD and press Enter, this will import the database to MySQL from SQL Dump File in MySQL XAMPP Server;

C:\xampp\mysql\bin>mysql -u username -p database_name < path_to_mysql_file.sql

Replace ‘database_name‘ with the name of your database, username username and ‘path_to_mysql_file.sql’ with the name of your SQL file. Make sure that the SQL file is in the same directory as the windows command prompt.

As soon as you press Enter with the typed command, Windows will ask you for your user’s password at the command prompt, so enter this password and press Enter.

Step 4: Verify the Import Database

You will now see a confirmation message on the Windows command promp or cmd, which means your database has been imported into the MySQL xampp server.

Or there is another option to verify, you open the browser and type us http://localhost/phpmyadmin url, it will open phpmyadmin and here you can select your database and verify it.

Video guide on importing database to MySQL XAMPP server from SQL dump file using Windows command line or CMD:

Conclusion

Using the steps from the tutorial guide, quickly imported the database from the SQL dump file into the MySQL XAMPP server using the Windows command line or prompt.

Recommended Tutorials

AuthorAdmin

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *