By Mohit Pandey
So, my site got messed up due to DDoS attack due to which I had to uninstall and install MYSQL again. I found that it isn’t wordpress database and the backup which I have is corrupted one and another backup which I have is from March’22. But now my backup is in .sql while it needs .ibd format so I can’t transfer these backup directly from SFTP.
I tried doing it from CLI using following statement:
mysql -u your_database_user -p wordpress -h localhost < your_backup_file.sql
and this was the output:
$ mysql -u root -p wordpress -h localhost < db.sql
-bash: db.sql: No such file or directory
$ mysql -u root -p wordpress < db.sql
-bash: db.sql: No such file or directory
$ mysql -u root -p wordpress -h localhost < /var/lib/mysql/db.sql
Enter password:
So, after entering the password isn’t showing any output. I’m using droplet’s root password. Or do I need to use the db_password from wp-config file?
I also did this in a new droplet but I’m getting same error for the transferring database.
In 1 case I the data was transferred but I got this on homepage
There has been a critical error on this website.
Please help me out
Thanks!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello there,
You’ll need to use the password for the database which is also stored within the wp-config.php file indeed.
- mysql -u username -p new_database < data-dump.sql
**username ** is the username you can log in to the database with newdatabase is the name of the freshly created database data-dump.sql is the data dump file to be imported, located in the current directory
If the command runs successfully, it won’t produce any output. If any errors occur during the process, MySQL will print them to the terminal instead. To check if the import was successful, log in to the MySQL shell and inspect the data. Select the new database with USE new_database and then use SHOW TABLES; or a similar command to look at some of the data.
You can also check our tutorial on How To Import and Export Databases in MySQL or MariaDB
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.