You can easily import/export your database using phpMyAdmin menu in cPanel, but when dealing with large databases over 50Mb it is recommended to manage them via SSH. In this article, I will cover exporting and importing a database via SSH. Make sure that you replace the following variables in the commands below:
USERNAME - the MySQL user assigned to your database.
DATABASE - the name of your MySQL database.
To export a MySQL database, you need to use the mysqldump command. Here is the full command for exporting your database:
mysqldump -uUSERNAME -p DATABASE > backup.sql
You will be prompted for a password - this is your MySQL user's password.
The MySQL database will be exported to a file named "backup.sql" in your current directory.
To import a MySQL database, you need to use the mysql command. Here is the full command:
mysql -uUSERNAME -p DATABASE < backup.sql
Again, you will be prompted for the password of your MySQL user.
The backup.sql is the name of the file that you are importing to your database. It must be in your current working directory.
I recently upgraded to a new hosting provider and wanted to migrate my wordpress site, Already backup my hosted files and exported database through phpMyAdmin, I'v created a different database with different details in my new server and i tried to import .SQL file to the new database. Although, when I upload it mid-way through I got this following error:
Web site and database assimilation is a necessity for many of today's businesses, and learning to work with PHP is key to integration success. The objective of PHP with MySQL Essential Training is to teach both new and experienced web developers the comprehensive steps for building dynamic, data-driven, interactive websites. Using PHP 5.2.x and MySQL 5.0.x, instructor Kevin Skoglund demonstrates the entire process of building a content management system. He starts with the basics of the PHP language (variables, arrays, loops, functions, etc.) and works up to building dynamic web pages with a MySQL back end. Kevin also covers blueprinting applications; structuring and interacting with databases; building, validating, and processing forms; and regulating user access with passwords.