I have a MySQL database existing on a remote server. I only have sql connection privilege. I don't have FTP access to the server, and I need to do a complete dump of the database. I have tried mysqldump, but the issue is that it is creating the output on the server and as I don't have FTP I can not get the output from the server.
How can I do a clean backup and get the dump in my local machine(of course, the backup should be restored in my local machine)?
You can specify the server name as an option to mysqldump:
mysqldump --host servername dbname > dbname.sql
mysqldump --host hostaddress -P portnumber -u username -ppassword dbname > dbname.sql
Normally the remote port of MySQL is 3306. Here is an example:
mysqldump --host 192.168.1.15 -P 3306 -u dev -pmjQ9Y mydb > mydb.sql
You can use the MySQL workbench http://www.mysql.com/products/workbench/, which can backup directly to a local folder through a user-friendly interface
mysqldump.exe locks tables by default, so other SQL actions are not possible during a dump. Without locking any tables, use the following syntax to backup a complete remote db and dump everything on your local machine:
mysqldump -u username -p --single-transaction --quick --lock-tables=false -h ipaddress myDB > backup.sql
Change username into your own username, change ipaddress into the remote ip address, and myDB to the actual database you want to backup. This will prompt you for your password. Once provided, the dump starts.
I use SQLyog for this where we can connect to the remote server and take a back up with this tool.
If the server admits PHP, you can upload and try Adminer. I like it as a PHPMyAdmin replacer, and you can create backups with it!
Related
I have Mysql installed on my local PC and want to use mysqldump on my local pc to dump a remote database. So I open CMD and run the following command:
mysqldump -P 3306 -h 12.43.33.43 -u admin -p myDatabase > mydb.sql
So in the next line it should ask for my password? but instead i get the response 'Access is denied'. Am i missing something here?
ps.
If I try the following:
mysqldump -P 3306 -h 12.43.33.43 -u admin -p myDatabase
it will successfully ask for my password and start printing the dump in cmd, but this is no good as i need the response saved in a file.
I only wanted to know if you could connect.
The command is
mysqldump -P 3306 -h 12.43.33.43 -u admin -p --databases myDatabase --result-file=mydb.sql
As the connection is not secure, you send your credentials like a postcard, so that every one can read it.
Besides that having your server exposed to the internet, is very dangerous and can come to a disaster, so reconsider your security strategy and allow only access via ssh.
I have a AWS Production server with RDP database.
I am accessing db in remote desktop using Putty through this command -
mysql -h ----------.rds.amazonaws.com -P (port number) -u (master username) -p (master password)
Now I want to dump the server db into a file. In my local MySQL I use to do it through -
mysqldump -u (user name) -p (password)
But in case of live server I tried this command -
mysqldump -h --------.rds.amazonaws.com -P (port number) -u (master username) -p
this is not working. How can I dump server RDP db.
Correct command is -
mysqldump -h --------.rds.amazonaws.com -P (port number) -u (master username) -p (database name) > (.sql file name).
This way we dump the server DB in a file.
Remember to move on .sql file location before running this command in putty.
Thank you.
I have a local mysql dump that I want to copy-insert into a remote db:
mysqlimport --host=192.168.xxx.xxx --user=username --password=password remote_table /tmp/export.txt
Result:
mysqlimport: Error: 1290, The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
So how can I tell my remote mysql server to accept imports from remote machine?
i) take mysql dump as follows
mysqldump -u user -p db-name > db-name.out
ii) Copy db-name.out file using sftp/ssh to remote MySQL server:
scp db-name.out user#remote.box.com:/remoteBoxDirectory
iii)Restore database at remote server (login over ssh):
mysql -u user -p db-name < db-name.out
or
mysql -u user -p 'password' db-name < db-name.out
I am trying to get database backup from remote system, please anyone help me to get backup from remote system. Here is the query which I executed, but its giving error.
mysqldump --host <host or IP address> -P <port Number> -u <username> -p<password> databaseName > c.sql;
remove ; from your syntax and execute below command-
mysqldump -h<IP_address> -u <username> -p<password> databaseName > backup.sql
If you want to take backup in your working directory else give a path. I have removed port option here as assuming that it will be running on default port 3306 else add in command.
Make sure your user should have permission on db server.
I am running mysql server on my computer.I would like to copy the databases i have created and their tables to a remote server,and that is my website.Is there a software(a windows software) that can help me copy my databases to a remote server?.
If you have external access to both mySQL servers, HeidiSQL is a great Windows GUI for mySQL with a good export function.
Alternatively (also needing external access), install the mySQL binaries on your machine and do a simple
mysqldump -h hostname_source -u username -p databasename > dump.sql
mysql -h hostname_target -u username -p databasename < dump.sql