Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I want to do the mysql-dump using perl script.Backup from some tables from mysql database in perl script.
system(mysqldump -u username -pPassword databasename database table > to /local path) or die..;
Tell me this line which will store backup file of tables to the local path.
Have you tried running that line from the command prompt? It looks like it should work. Are you putting the command in quotes?
system('mysqldump -u username -pPassword databasename database table > to /local path') or die('This failed');
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 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 not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I have a shell script that is running as a cron job, which creates a database dump for backup purposes. When I tried doing the same in a Jenkins execute shell, the following line seems to be giving errors:
mysqldump -p thepassword -u theussr --all-databases > databases.sql
What happens is that the following error gets into the databases.sql file:
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help
I am confused as what is going wrong here. I tried with "-r databases.sql" and the file comes out empty with the error being printed in the console.
For me, this works in Jenkins:
mysqldump -hxx.xx.xx.xx -pmy_pwd -umy_user db_name > ${filename}
I am generating the file name with time stamp, like:
filename=$(date +'%Y%d%m-%H_%M').sql
My problem was the space in -p mypassword, however with removing the space it did not work either.
Finally this helped resolve the issue:
export MYSQL_PWD=yourverysecretpassword
mysqldump -u theussr --all-databases > databases.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 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 :)
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.