Import a MySQL database from the console
In our previous post we saw How to export a MySQL database from console. Today, we will see how to perform the import or restoration of said backup. Without further ado, you can use the following command to import an SQL file into your MySQL database.
mysql -u user -p database < file.sql
Remember that you must replace user
and database
according to the user with which you will authenticate and the database to which you want to import the script.
Important note: If you are using Windows, this command will not work from PowerShell or Cygwin. You must execute it from CMD.
Don't forget to check out our article Connecting to MySQL through Terminal where you will discover different ways to connect to the MySQL console. See you next time.
Categories
- Laravel
- Sublime Text
- OpenSSL
- PHPUnit
- Go
- Apache
- Docker
- MySQL
- OWASP
- SOLID
- JOSE
- PostgreSQL
- Static Code Analysis
- SSH
- Digital Ocean
- Java
- Javascript
- GNU/Linux Debian
- PHP
- POO
- Lenguaje C
- Lenguaje C++
- RegExp
- HTML
- Vue.js
- HTTP
- Redis
- Supervisor
- Buenas prácticas
- Ubuntu
- Webpack
- Vim
- Linux
- Arch Linux
- CSS
- Flutter
- Laravel Vapor
- CI/CD
- cPanel
- WHM
- Networking
- Python
- MacOS
- Lógica y algoritmia
- Git
- Dart
- AWS
- Codeception
- Visual Studio Code
- TypeScript
- SEO
- Node.js
- Nuxt.js
- Google Cloud