Hi,
I use Ubuntu and want to restore a mysql file. How do i do it? It is on my desktop.
Thanks
Hi,
I use Ubuntu and want to restore a mysql file. How do i do it? It is on my desktop.
Thanks
Good — this was just a path problem. confirmed that adding the full home path fixed the restore, and was right to suggest using the command line. Two common, reliable ways to restore a .sql dump on Ubuntu are shell redirection and the mysql client's SOURCE command; the difference matters because the shell opens files for < while SOURCE is resolved by the mysql client itself.
Examples (adjust user, database and filename):
mysql -u root -p database_name < /home/ubuntu/Desktop/backup.sql mysql -u root -p
mysql> USE database_name;
mysql> SOURCE /home/ubuntu/Desktop/backup.sql; For compressed dumps:
gunzip -c /home/ubuntu/Desktop/backup.sql.gz | mysql -u root -p database_name Quick troubleshooting checklist:
ls -l /home/ubuntu/Desktop/backup.sql. The user running the command must be able to read the file. sudo systemctl status mysql). CREATE DATABASE/USE statements you can omit database_name; otherwise create the target DB first. screen/tmux and adjust max_allowed_packet if you see packet-related errors.Cautions: restoring will overwrite tables if names collide — keep a backup of any existing data before importing.
Jump to Post— John A 1,896Through the command line?
Through the command line?
i didn't put /home/ubuntu before. Now it works.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.