I'm using the portable version of WAMP which is "Wampee" 2.1-beta-2 on Windows XP.
Im launching C:\Wampee-2.1-beta-2\bin\mysql\mysql5.5.8\bin\mysql.exe in order to try a mysqldump.
I do:
mysqldump -u root -p database_name > backup.sql
And it answsers "You have an error in your SQL syntax [..]"
Even this command give me the same result:
mysqldump --help;
How to know if mysqldump is installed and/or enabled? Or my syntax is really wrong?
Thx
Regards
I just found! Mysqldump is another program so you can't access to it from mysql.exe
Open a terminal window such as cmd.exe. Change directory to mysqldump.exe:
cd /go/to/the/mysqldump/folder
Launch mysqldump
mysqldump.exe
Type your commands.
HTH! (:
Related
I am trying to back up a database from terminal on a mac for first time
I use Xampp for SQL
But trying to back up from terminal
Trying
myusername$ mysqldump planet > planethealth.sql
but getting
-bash: mysqldump: command not found
I access xampp with following command and no password
/Applications/xampp/xamppfiles/bin/mysql -u root -p
Please help, project due tonight
I'm not personally a mac user but you have to find the binary for mysqldump, looking at your xampp path it maybe in:
/Applications/xampp/xamppfiles/bin/mysqldump
But that is just a guess. If it is you could try:
/Applications/xampp/xamppfiles/bin/mysqldump -u root -p planet > planethealth.sql
Alternatively if the binary is not in that location you may have to go and install it.
Hope this helps, good luck with the project!
It's quite simple really, I just can't figure out the syntax.
I want to replicate my server setup on another server.
I can dump all my databases with
mysqldump -uroot -p --alldatabases > all.sql
But how do I import ALL of those into a brand new mysql setup on another server?
mysql -u root -p < all.sql
will do
From command line:
mysql -uroot < all.sql
ps. If you want to see what statement is executed right now you should -v.
if the database servers are both near enough the same version, you could simply rsync the /var/lib/mysql directory over.
rsync /var/lib/mysql root#destination.server.com:/var/lib/ -a
Edit: Please note that there are some issues with this approach which require some additional steps:
http://verens.com/2016/05/11/quick-method-to-clone-a-mysql-database/
mysql -u root -p
that command will open the mysql interactive console, where you'd do this:
source all.sql
execute the dump file from shell (dump file should contain the CREATE DATABASE syntax)
mysql -uroot < /path/to/file.sql
or execute from mysql
source /path/to/file.sql
I'm having some difficulty with mysqldump. I locked my tables and ran the following command:
mysqldump -u user -p password databasename using my actual password and database name.
When I run this from mysql I get a 1064 error that says there is an issue with my syntax. I've also tried running the command from terminal (outside of mysql) and receive a 'command not found' error message. I'm not entirely sure how I should be doing this (the explanations I've found so far have been vague).
Thanks for the help.
The mysqldump is a program, it cannot be executed from the mysql console. Run it from the shell.
Have a look at the syntax reference.
--user=user_name, -u user_name
--password[=password], -p[password]
As you see there is no space between -p and password. So, your command line should be like this:
>shell mysqldump -u <user_name> -p<user_password> ...
or
>shell mysqldump --user=<user_name> --password=<user_password> ...
You are missing the target backup file name:
# [mysql dir]/bin/mysqldump -u username -p password --databases databasename > /tmp/databasename.sql
MySQL Commands
the correct syntax is
mysqldump -u [username] -p[password] [databasename] > [backupfile.sql]
you should add the > backupfile.sql
the other error is believe your system doesn't recognize the mysqldump path and you should go directly to bin folder from mysql installation.
I have WampServer 2.0 that is installed on Windows on my laptop.
I'm running on it an application that I wrote. The application is working with MySQL database.
I would like to make backups of this database periodically.
How this can be done ?
How could I define cron on Windows ?
The rough equivalent of crontab -e for Windows is the at command, as in:
at 22:00 /every:M,T,W,Th,F C:\path\to\mysql\bin\mysqldump.exe ...
Running the at command by itself lists the tasks you've created using at.
The mysqldump documentation is here.
The most popular way to backup MySQL database is to use mysqldump:
Open a Windows command line.
Specify the directory to mysqldump utility
cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
Create a dump of your MySQL database.
mysqldump.exe --user=YourUserName --password=YourPassword --host=localhost --port=3306 --result-file="Pathdump.sql" --databases "DatabaseName"
Also, there are a lot of third-party tools, which can perform MySQL backups automatically on a regular basis.
You could use a bash script.
#!/bin/sh
mysqldump -uroot -ppwd --opt db1 > /sqldata/db1.sql
mysqldump -uroot -ppwd --opt db2 > /sqldata/db2.sql
cd /sqldata/
tar -zcvf sqldata.tgz *.sql
cd /scripts/
perl emailsql.pl
http://paulbradley.tv/38/
I am using mysqldump to take backup of my database, but the command is not working..
the command i am using is mysqldump -u root dbname> 'c:\backupdatafolder\backup.sql'
i am running this command in MySQL cli but not running,..is there any thing wrong in the command?
You are supposed to run that on the command line of your operating system not on the MySQL CLI.
cd to the bin folder of MySQL first, something like C:\mysql\bin or wherever your MySQL is installed on
If the mysqldump can not be identified by your CMD prompt (I believe you are using Windows), then you first have to go to the bin folder where this command can be found. In my case, the path is "C:\wamp\bin\mysql\mysql5.5.24\bin", it would be more or less the same path for you. After that open your CMD prompt and go to this path by command "cd C:\wamp\bin\mysql\mysql5.5.24\bin". Now you should run your mysqldump command for taking the backup as you have been trying. Hope this helps!