how to import a database
Moderator: General Moderators
how to import a database
Hello every one.
These days i have faced to big problem . it is g database my database. My database type is mysql and it is so big. i want to know how can i import a database except using Phpmyadmin and things that i must say about my condition are my database is on myftp and the extension of it is .gz and my server is Linux and dont access to shell to use its command for importing database.
Thanks
These days i have faced to big problem . it is g database my database. My database type is mysql and it is so big. i want to know how can i import a database except using Phpmyadmin and things that i must say about my condition are my database is on myftp and the extension of it is .gz and my server is Linux and dont access to shell to use its command for importing database.
Thanks
Re: how to import a database
You need shell access, or you need to get someone who has shell access to do it for you. Running a large scale SQL dump through a browser is a bit impractical.
Or, alternatively, you could break the SQL file up into smaller chunks.. they are just text files really so you split them into smaller bits and run them one by one. Though that really depends how big it is.. if your database is gigabytes in size that's still a bit impractical.
Or, alternatively, you could break the SQL file up into smaller chunks.. they are just text files really so you split them into smaller bits and run them one by one. Though that really depends how big it is.. if your database is gigabytes in size that's still a bit impractical.
Re: how to import a database
Thanks for reply .Could you tell me how to split my database in small part and say me after splitting how to import with phpmyadmin?
Thanks
Thanks
Re: how to import a database
No.
I could easily, but there was less than 10 minutes between my post and your reply, so you clearly haven't bothered to think about it at all. If you aren't going to put any effort into finding a solution to your problem then I see no reason why I should.
I could easily, but there was less than 10 minutes between my post and your reply, so you clearly haven't bothered to think about it at all. If you aren't going to put any effort into finding a solution to your problem then I see no reason why I should.
Re: how to import a database
A little hack to gain sheell-like access 
Create a php file in your web root directory:
and by using your www browser browse it ONCE.
If there are any errors they will be displayed in your browser - fix'em and retry.
After finishing the import - remove this file.
PS: Please, notice there is NO white space between -p and YOUR_DB_PASSWORD - this is how it SHOULD be.
Create a php file in your web root directory:
Code: Select all
<?php
echo system("gunzip /full/path/to/database_backup.gz -c | `which mysql` -u YOUR_DB_USERNAME -pYOUR_DB_PASSWORD DATABSE_NAME 2>&1");
?>If there are any errors they will be displayed in your browser - fix'em and retry.
After finishing the import - remove this file.
PS: Please, notice there is NO white space between -p and YOUR_DB_PASSWORD - this is how it SHOULD be.
There are 10 types of people in this world, those who understand binary and those who don't
Re: how to import a database
it was a great help. now let me know how to import it with specific charachter encoding such as utf-8 or the same as that.
Regardes
Regardes
Re: how to import a database
Take a look at http://www.manpagez.com/man/1/mysql/
There are 10 types of people in this world, those who understand binary and those who don't
Re: how to import a database
thanks for above link. here is a problem i dont know how to add or set Default Character Set and Collation in that command .For example add utf-8 and utf8_unicode_ci collation.
Please help me.
Please help me.
Re: how to import a database
Read the man-page
o --default-character-set=charset_name
Use charset_name as the default character set. See Section 8.1, "The
Character Set Used for Data and Sorting".
There are 10 types of people in this world, those who understand binary and those who don't
Re: how to import a database
I've read it. But my problem is how to use them . because i've got some errors like below.
/usr/bin/mysql: unknown option '-d' /usr/bin/mysql: unknown option '-d'
Re: how to import a database
I know -D, not -d ...
There are 10 types of people in this world, those who understand binary and those who don't