Entering large file of sql to phpmyadmin database - php

What is the SQL code to import an database to phpMyAdmin? I have tried using the import tab but it does not allow to import as the file size is too large than the given limit???

You need to use MySql CLI:
> mysql -uUser -pPassword
> use DatabaseName
> source full_path_till_file.sql

Use BigDump from http://www.ozerov.de/bigdump/. Just put this script and your big SQL file on FTP and run the script. I tried it on ~2GB SQL file and it works without any problems.

Related

cannot import too large sql file to mysql

I have a 28 MB sql file need to import to mysql.
Firstly, i'm using xampp to import, and it fails, and so i change my max_file_uploads, post_size(something like that)in php.ini-development and php.ini-product to 40 MB, but it still show "max:2048kb" and import fail again.
From research, i've learned to import by using mysql.exe, so i open mysql.exe and type the command line(msdos) below:
-u root -p dbname < C:\xxx\xxx\sqlfile.sql
but still failed again and again.....
what the problem is? xampp? or my sql setting?
Try this:
mysql -uroot -p --max_allowed_packet=24M dbname
Once you log into the database:
source C:\xxx\xxx\sqlfile.sql
I think that you should be able to load your file
How large is your file?. You might as well do it from a console:
mysql -u##USER## -p ##YOUR_DATABASE## < ##PATH_TO_YOUR_FILE##
Do that without executing your mysql.ext file: just "cd" right into the directory and try the command.
It will ask for your password and start importing right away. Don't forget to create the database or delete all tables if it's already there.
I always found this approach quick, painless and easier that rolling around with php directives, phpmyadmin configuration or external applications. It's right there, built into the mysql core.
You should increase max_allowed_packet in MySQL.
Just execute this command before importing your file:
set global max_allowed_packet=1000000000;
I also fetched the similar problem. So after that I also conclude , large sql file will never be imported to mysql. It will always give timeout error.
Then I found a solution.
There is an software Heidisql.
follow below steps:-
1) download the software.
2) then install the software
3) create new session in Heidisql and open the session
4) then go to Tools -> Load SQL File -> Browse.
That's it. This solution works best for me.
check the link here
I found the only solution was to log in to MySQL from the command line and use the 'source' command:-
1) cd to the directory containing your SQL file for import, then log into MySQL:
#> mysql -u YOURUSERNAME -p -h localhost
2) use MySQL commands to import the data:
#> use NAMEOFYOURDB;
#> source NAMEOFFILETOIMPORT.sql
This also feeds back info about progress to your terminal, which is reassuring.

import .sql file into database found on a server

i am using phpmyadmin and i exported the database which I had locally. The exported file has an extension of .sql. I want to import the exported database into a database found online on the server. The server doesnt use phpmyadmin. I already connected to the database using SQL wave software however it doesn't offer the import feature like phpmyadmin does. After i installed mysqldumpler however i have the same problem. I cannot browse and import a .sql file. Can someone tell me how i can import the .sql file into my live database? Maybe a software you know or a command?
Copy the file to server. SSH into the server. Then you can load with the command line client:
mysql -u username -p dbname < path/to/file.sql
You will need to create the DB first.

restore large databases in mysql via phpmyAdmin

i already save a backup for all databases in phpmyadmin by about 4.5 MB and gzip format.
but now i want to restore that in phpmyAdmin via import tab. but we know that max allowed size for upload a file is 2,048KiB and when try to upload shown this message error:
No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration
i use MySQLDumper script to restore but in this script we can choose only one database to restore while i want to restore all my databases that i had.
how can i do this. i use wamp on windows 8.
You can restore large database using mysqldumper http://www.mysqldumper.net. If you want to restore it on your domain server first you upload sql file using ftp and then restore using mysqldumper
You can bypass having to use phpmyadmin by using the terminal.
You should unzip your mysqldump first.
Get the DOS command prompt by typing "cmd" under Start->Search programs and files.
Navigate to the directory where your mysqldump is, and then type (for single database):
mysql -uusername -ppassword name of database < filename of the mysqldump
If you want to restore all the databases (it seems like you dumped using --all-databases):
mysql -uusername -ppassword --databases name of database name of another database name of yet another database < filename of the mysqldump
Also note that there is no space in between -u and the username, and -p and the password.

How can I convert MySQL database to SQLite in PHP?

I need PHP code to convert the database. I tried How to convert mysql to SQLite using PHP but it dint have answer
I finally found its solution.
Save sh file available at
https://gist.github.com/943776
and execute
"./mysql2sqlite.sh DBNAME --databases DBNAME -u DB_USERNAME -pDB_PASSWORD | sqlite3 database.sqlite"(without qoutes and with "`")
in php file.
Save both files in one folder
Go to phpmyadmin
click export database
download as sql file.
Download it....
go to your sql lite management software
import the .sql file
done...

Importing huge Database into local server

Is there any way I can Import a huge database into my local server.
The database is of 1.9GB and importing it into my local is causing me a lot of problems.
I have tried sql dumping and was not successful in getting it in my local and have also tried changing the Php.ini settings.
Please let me know if there is any other way of getting this done.
I have used BigDump and also Sql Dump Splitter but I am still to able to find a solution
mysql -u #username# -p #database# < #dump_file#
Navigate to your mysql bin directory and login to your mysql
Select the database
use source command to import the data
[user#localhost] mysql -uroot -hlocalhost // assuming no password
[user#localhost] use mydb // mydb is the databasename
[user#localhost] source /home/user/datadump.sql
Restoring a backup of that size is going to take a long time. There's some great advice here: http://vitobotta.com/smarter-faster-backups-restores-mysql-databases-with-mysqldump/ which essentially gives you some additional options you can use to speed up both the initial backup and the subsequent restore.

Categories