Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I need to export a table of size 3GB to another database. Both are on different server.
When i tried to export using phpmyadmin tool, It leads to server error.
Also both database are on different servers. I need to export and import into other server.
Please advise.
Use mysqldump if that is a possibility, archive it and copy it afterwards to the new server.
If mysqldump is not accessible, phpMyAdmin has a feature to export it already archived ... try with that.
MySQL provides a tool exactly for this purpose:
commandline_of_your_choice#> mysqldump -uusername -p -hlocalhost DB_Name --single-transaction | mysql -uusername -p -hremotehost DB_Name
Simple as that :)
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
How can i export database from workbench and import to phpmyadmin using dump file. ?
make sure you on root
Export Data syntax
mysqldump -u username -p database_name > data-dump.sql
Import DB
mysql -u root -p purchase_commerce < /opt/data-dump.sql
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I need to copy all the stored procedures from one schema to another programmatically with an SQL script.
How can I do this in MySQL? I don't want to have to run a PHP script.
Thank you
EDIT: I am on MySQL 8. Table mysql.proc doesn't exist. Also, the schemas are on the same server.
Dump the routines from one schema with mysqldump
https://dev.mysql.com/doc/refman/8.0/en/mysqldump-stored-programs.html
like
mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt yourdb > yourdb.sql
and import into the new one
mysql -u root -p yournewdb < yourdb.sql
reference
select * from mysql.proc
to obtain wat you want.
Good work.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
Hai I am trying to upload mysql database using putty i have tried few commands,
mysql -u {DB-USER-NAME} -p {DB-NAME} < /var/www/html/sample.sql
and tried
plink mysql -u username -p database_name < /var/www/html/sample.sql
but unable to upload files to linux server any suggetions
Try this syntax
mysql -u {DB-USER-NAME} -p --database={DB-NAME} < /var/www/html/sample.sql
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
What I would like to do is connect to a database that runs a website. Then copy the contents of that database to another database, on a different server. Can this be done?
It can be done and there are different ways to do it. I'll list 3 different ways
Run mysqldump -h<source host> | mysql -h<target host>. You'll have to read up on the mysqldump options to decide which you need to add and you probably need to put options for user, password and databases as well.
Copy all files that mysql uses and put them on the new host. As long as the new server is configured the same way it will work
Use Perconas xtrabackup. This is probably the best option if the database is large. The database can still run while the backup is being made. This option will create an exact copy of the database and that may or may not be wanted.
Generally if the database is small option 1 is easiest.
Yes, but it depends on how the database is set up.
Most databases that run behind a web server will not be accessible externally, for security reasons. Your best bet, assuming you have access to the server, is to login to the shell and dump the database. MySQL has the tool mysqldump to help with this. In a pinch:
mysqldump -u username -p schemaname > yourdatabasedump.sql
Alternatively, you could install PhpMyAdmin on your server (assuming PHP is enabled) and dump the database from there.
Importing is the opposite. Get shell access on the other server and do something like this... First, create your schema:
mysql -u someuser -p
> CREATE DATABASE schemaname;
> exit
Then import.
mysql -u someuser -p schemaname < yourdatabasedump.sql
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I am try to restore a big database from file using this command
source /path/to/database/file
it is return this error:
Failed to open file '/path/to/database/file', error: 27
the .sql file size 4.1G
If that's a file created by the mysqldump command, you'll probably want to run it using the mysql program. That'll be something like mysql -u <username> -p <databasename>
The mysqlimport command is another command you might wanna look at.