phpMyadmin backup and restore database - mysql

I have database named s3d_db in my web hosting plan on godaddy and i want to backup this database and restore it in another database in VPS plan on godaddy where the new database name is webapp_s3d_db. So i used the export option in s3d_db database and than import option into new webapp_s3d_db database using default option for both export and import but i found that one of the tables in old database has ~49,023 Rows and the same table in new database has ~90,678 Rows. How i can do this task in a proper way ?

The ~ character means phpMyAdmin is approximating the number of rows so this may not be an issue.
To export your database I would suggest you use the command line rather than phpMyAdmin:
/usr/bin/mysqldump -u USERANME -p DATABASE_NAME > output.sql
Run that, you'll be prompted for your database password and then you'll get output.sql containing your database
You can then import this using ..
/usr/bin/mysql -u USERNAME -p DATABASE_NAME --no-create-db < output.sql

Related

PhpMyAdmin database Export.

I am exporting database from PHPMYADMIN. Database has 341 tables on remote server but when I import Sql file into local server PHPMYADMIN I got only 213 Tables.
Question :
How can I get all tables of database on localhost.
phpmyadmin should export all when you do export -> quick, but try to use the custom option and make sure all are selected. Also, may want to check the mysql mode (select ##global.sql_mode) of local and remote. If your local has default settings, there may be some tables with data in a column that's not allowed.
Assuming that your database is pretty large then you may have more success with exporting it via the command line rather than phpMyAdmin:
/usr/bin/mysqldump -u USERANME -p DATABASE_NAME > output.sql
Run that, you'll be prompted for your database password and then you'll get output.sql containing your database
You can then import this using ..
/usr/bin/mysql -u USERNAME -p DATABASE_NAME --no-create-db < output.sql

How to import all databases sql file into phpmyadmin

I have exported all databases (localhost.sql) from phpmyadmin. Now I am trying to import all database file (localhost.sql) using command
mysql -u root -p < /localhost.sql
this is showing error as No database selected.
Localhost.sql has all database, i dont have any other backup of databases except localhost.sql file.
Because when you export file into phpMyAdmin there is no database name. If you want it, when you export click "Custom" in the section export method and tick "Add CREATE DATABASE / USE". Or add at the top of your localhost.sql :
CREATE DATABASE IF NOT EXISTS `NameOfYourDataBase` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `NameOfYourDataBase`;
Or the method I use : I export, i drop/delete everything and i recreate a DB with the same name THEN I import the localhost.sql
These information will useful to you.
Only one database backup:
mysqldump -d -h localhost -u root -pmypassword databasename > databasename.sql
or
mysqldump database_name > database_name.sql
Multiple databases can be backed up at the same time:
mysqldump --databases database_one database_two > two_databases.sql
It is also simple to back up all of the databases on a server:
mysqldump --all-databases > all_databases.sql
Thank you..

how do you port a mysql database?

I'm moving servers and I wish to keep my database what are the step by step commands to move the entire database or at least an entire table with all the rows?
$>mysqldump -u <user> -p<password> <databasename> > dump.sql
... move file to new box
$>mysql -u <user> -p<password> <databasename> < dump.sql
firstly you need to get a backup from entire database using phpmyadmin export section at old server
secondly you need to import the backup file at new server phpmyadmin import section.
you can define a new user for imported database by user privileges section of phpmyadmin

Is it possible to export all my MySQL databases and users into a single file?

I am moving hosting providers and I have about 20 sites that I'm moving and you guessed it, they all have MySQL databases and unique users. Is there an easy way to export all these sites databases and users into a single file or a few files so that I dont have to individually export each one and create a new user, etc. on the new host?
mysqldump --no-create-info -h hostname --user user -pPa55word mysql >dump.sql
Now edit dump.sql and take out everything you don't want. Alternatively just dump the user table
mysqldump --no-create-info -h hostname --user user -pPa55word mysql user >dump.sql
Then import
mysql -u user -pPa55word mysql < dump.sql
After importing the SQL file you will have to run
FLUSH PRIVILEGES;
on the destination MySQL server, in order for the change to take effect immediately.

Is there a way to copy all the data in a mysql database to another? (phpmyadmin)

I want to copy all the tables, fields, and data from my local server mysql to my hosting sites mysql. Is there a way to copy all the data? (It's only 26kb, very small)
In phpMyAdmin, just export a dump (using the export) tab and re-import it on the other server using the sql tab.
Make sure you compare the results, I have had phpMyAdmin screw up the import more than once.
If you have shell access to both servers, a combination of
mysqldump -u username -p databasename > dump.sql
and a
mysql -u username -p databasename < dump.sql
on the target server is the much more fast and reliable alternative in my experience.
Have a look at
Copying MySQL Databases to Another Machine
Copy MySQL database from one server to another remote server
Please follow the following steps:
Create the target database using MySQLAdmin or your preferred method. In this example, db2 is the target database, where the source database db1 will be copied.
Execute the following statement on a command line:
mysqldump -h [server] -u [user] -p[password] db1 | mysql -h [server]
-u [user] -p[password] db2
Note: There is NO space between -p and [password]
I copied this from Copy/duplicate database without using mysqldump.
It works fine. Please ensure that you are not inside mysql while running this command.
If you have the same version of mysql on both systems (or versions with compatible db file sytsem), you may just copy the data files directly. Usually files are kept in /var/lib/mysql/ on unix systems.