I want to export my database and i am using this code:
mysqldump -p -u markazo_b markazo_b > /tmp/file.sql
But SSH show this error:
-bash: mysqldump: command not found
How i fix this problem?
If mysqldump is not identified by the cmd prompt that means it cannot recognize where the mysqldump.exe is located. You need to add path of the directory where the exe is located in the PATH variable under environment variables. After doing that your command will start working in the cmd prompt.
The mysqldump tool is located in the root/bin directory of the MySQL installation directory.
It dumps one or more MySQL databases for backup or transfer to another SQL server. The mysqldump command can also generate output in CSV, other delimited text, or XML format.
To dump/export a MySQL database, execute the following command in the Windows command prompt: mysqldump -u username -p dbname > filename. sql . After entering that command you will be prompted for your password.
After reading your conversation, I found the solution (for me, at least). It was a permissions issue.
Issuing which mysqldump
in the terminal shows /usr/bin/mysqldump
.
When I then issue cd /usr/bin/
and afterward mysqldump
I receive the same indications you were seeing: mysqldump: command not found
.
Inside /usr/bin
I then issued sudo mysqldump
and received:
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
Try that and see if it helps.
Edit: too long, didn't read: sudo mysqldump
may work. (May be a permissions issue.)
The solution I found is adding MySql's installation directory to PATH
Steps:
(In the terminal),
locate mysqldump export PATH=$PATH:MY_SQL_INSTALLATION_DIRECTORY/bin
MY_SQL_INSTALLATION_DIRECTORY is the directory you found by locate mysqldump
: Example
export PATH=$PATH:/usr/local/mysql-5.6.23-osx10.8-x86_64/bin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With