import /export sql file into mysql database

 how to import large sql file in phpmyadmin?
Update: SSH Command mysql -u root -ppassword DBName < /home/pubclubindia/www/tspscjobs.co.in/tspsc.sql

worked fine. as on 1/2/2017.
Note: Zip version  file not import to mysql.

This works fine in all linux images  ubuntu, debian, centos, fedora, readhat etc

Note: DB Name < Import, > for export.

To export all databases into a dump:

mysqldump --all-databases > all_databases_export.sql
To import one of these mysql databases from the dump into a database:

mysql --one-database database_name < all_databases_export.sql
 
i am trying upload databases from phpmyadmin. 
hostgator and bluehost have 50Mb limit for sql file.
time i split my databases using sqldumpsplitter. and uploads parts one by one. it worked fine last time.  
but when try to upload getting connection timeout.
tried to Upload database from MySQL workbench. failed. 
i need to try ssh access. 
also i uploaded to home directory and asking them for import it to phpmyadmin. 
they are not replied they enabled shell access for my hosted domain.

I have found 4 methods to uploaded but those also not working because of shared server limits I think.

  1. using PHPMyAdmin.
  2. from the Cpanel control panel
  3. by splitting DB to small files
  4. MySQL workbench these 4 options not worked for me.
  5. using Putty ssh now I am going to try this. (simple & quick way worked later)

Really I don’t Know what to do every time searches on google new results and new methods.
Every time I get a problem like this I need to search research on google. sometimes may not found the perfect solution and many times not able to understand and do that. because some of them require technical knowledge.

Totally disappointed registered hosting plan 2 days still not uploaded database files which are 150 MB and 194 Mb. just created a thread on web hosting talk forum.

Also, I tried to compare all methods at one place below still confused. HoIe i think may of the newbies like me facing.  they may understand my problem.

Ways to Import /Export database Large ad small fewer than 50 Mb

  1. Using Php Admin
  2. Using cpanel backup options
  3. SQL dump splitter by large database into Parts
  4. Php script to import large database files
  5. Mysql workbench
  6. Using SSH putty commands Very easy.

Import exporting database bu SSH Command line Process

  1. Enable SSH Access
  2. Generate SSH Key
  3. Login with putty by entering below details
  4. Username: Cpanel user name
    Password: Your cPanel password
    Hostname: your website.com or IP
    Port: 22
  5. Sometimes you have to whitelist your ip to gain Jail Shell Access only from your IP.
  6. Upload your database to your cpanel Home Directory by gzip compressing to reduce database size.
  7. Create database and username and password to access.
  8. Run Import or export commands on Putty client as shown below.

Finally I’ve Uploaded my database to phpmyadmin?

  • uploaded to root folder

  • logged in putty by entering the shared ip, port 2222, cpanel username and password.

  • and i entered this command

  • mysql -u root -p db-name < backup.sql
    ex u database username
    p password

    database< path of sql file
    mysql -u seobackl_final -pRg22tg22 seobackl_bmarks < /home2/seobackl/public_html/DBS/2.sql.

    password no space after P. 


    this is also got some error connection timed out. also updated a ticket with hostgator. they uploaded. they uploaded but database size bigger than original sql file.
    i need to repair db using cpanel>>databases>>checkDB>Repair DB.

Importing database In shared Server?

The Only way is contact support they will do it for you in case file size is larger than 50 MB.

Becuase SSH / Shell access not works on major shared providers. use SQL dump splitter.

Check Phpmyadmin max upload SIZe limit.

How to use ssh in the shared server to import database from home directory to phpmyAdmin?

  • To access SSH, download WinSCP or PuTTY. Enter your IP address and port 2222; login with your cPanel username and password.

ssh access you can try this command:
mysql -u {database username} -p -h localhost -D {database name} < YourBackupName.sql
You will be prompted for the password for that database user.

upload to root folder
and try this command 
mysql -u<user> -p<password> <database name> < /path/to/dump.sql
 

Try to import it from mysql console as per the taste of your OS.
mysql -u {DB-USER-NAME} -p {DB-NAME} < {db.file.sql path}

mysqldump -u username -ppassword –all-databases > dump.sql
import export database using ssh
How to import and export a MySQL database using ssh.
To export a database use:


mysqldump -u root -p db-name > backup.sql

To import a database:

mysql -u root -p db-name < backup.sql
Ex:mysqldump –u seobackl –pg93s9wYjC2 seobackl_333 > /home2/seobackl/public_html/DBS/manabadi_atmarks.sql 

mysql -u [username] -p [database_name] < [dumpfilename.sql]

Example: mysql -u seobackl_final -pRg22tg22 seobackl_bmarks < /home2/seobackl/public_html/DBS/2.sql

    •  https://help.1and1.com/hosting-c37630/databases-c85147/mysql-database-c37730/import-a-mysql-database-using-ssh-a704884.html
    • http://www.itworld.com/it-management/359857/3-ways-import-and-export-mysql-database
    • http://www.inmotionhosting.com/support/website/database-setup/upload-large-database-over-50-mb 
    • http://support.hostgator.in/articles/hosting-guide/lets-get-started/how-do-i-get-and-use-ssh-access
    • https://www.namecheap.com/support/knowledgebase/article.aspx/9184/90/how-can-i-import-and-export-a-database-using-ssh-command
  • connected database from standard tcp connection database username and
 
 mysql import database command line
SQLDumpSplitter 2