Hot answers tagged

10

The short answer is, yes, definitely drop your existing tables before importing a new .sql file. If you don't, you run a high risk of Craft developing weird issues of data mismatching. This is especially true if the two versions of the database were not created with the same exact version number of Craft. NOTE: You may want to back up your existing database ...


2

If you've copied the Craft files to a new place on the server, then you can either leave the database connection information the same and have it keep on pointing to the current database instance, or edit craft/config/db.php (or your .env file if that's how you're setup) to point to a new database instance. If the new one is a blank database, the Craft ...


2

Craft uses MySQL's native mysqldump and PostgreSQL's pg_dump binaries to create database backups. In order for PHP to be able to execute those binaries, it needs to be able to run the proc_open and proc_close PHP commands. I would not consider it a security issue, but if you were really concerned about it, you can prevent Craft from making backups on ...


2

I have just run into a similar problem. I'm not sure if this is what fixed it but try creating an Envvars file as per jonlivingstone's comment here https://github.com/craftcms/cms/issues/2364 Once I had done that my backup ran. I then had to switch MAMP out of FastCGI mode otherwise I got a 500 error at the end of the update process.


2

I have run the following on my computer in order to allow Mac OS's terminal to speak to MAMP's MySQL. I have not done the steps outlined in your linked article. Craft's built-in backup tool works fine for me so perhaps this will help you too. sudo ln -s /Applications/MAMP/Library/bin/mysqldump /usr/local/bin/mysqldump Here's a github issue on the matter ...


2

Your server seems to be missing the shell command mysqldump, contact your IT-Specialist and tell him you need that to be installed you can backup your website. Or if you plan on installing it yourself, this should do the trick. Excerpt from there: sudo apt-get install mysql-client-5.7 If it's not able to find the package, try entering the statement till ...


2

They key is to get the database from the "backup database" function in the control panel that includes DROP TABLE IF EXISTS craft_analytics_settings; ... before it creates all the tables so you shouldn't have to delete any tables first, been working for us that way since the beginning.


1

The database backup from Craft is slightly different to the SQL export in phpMyAdmin. Craft’s export (presumably) assumes you’re going to want to import that data into an existing site, whereas phpMyAdmin’s default (presumably) assumes you’ll want to import it into an empty database. However you can do exactly as you suggest — export from phpMyAdmin locally, ...


1

Nope, the UtilitiesController is hard-coded to use .zip: $zip = new ZipArchive(); if ($zip->open($zipPath, ZipArchive::CREATE) !== true) { throw new Exception('Cannot create zip at ' . $zipPath); } $filename = pathinfo($backupPath, PATHINFO_BASENAME); $zip->addFile($backupPath, $filename); $...


1

When you do your export in phpmyadmin, make sure you check the 'disable foreign key checks' box in the custom options:


1

Not sure how the database backup was created and what's being used to restore it, but using this would fix the error: CREATE SEQUENCE IF NOT EXISTS 'public.assetindexdata_id_seq' Alternatively, if you delete the database to destroy all of the associated metadata, then it shouldn't matter. https://www.postgresql.org/docs/9.5/sql-createsequence.html


1

You can expose a port on your mariadb service then upload your backup using Sequel Pro or Workbench. Don't forget to add the restart:always to the service.


1

Partial solution - I removed all backups except the most recent from the backups folder. It seems that changing the site name prevented the site from finding the correct sql file or adding new backups to .ignore. If you want to change the name then be sure to remove other backups from the site directory.


1

******* Updated based on khalwat's comment ************ I don't think Craft does that automatically. Not sure about 3rd party plugins. I wrote a custom controller function to run by Cron Job, and it's been working fine. It does nothing but looping through the .sql files in the craft/storage/backups folder and delete the ones which are older than X days, ...


1

As Brad replied as a comment, the issue was indeed PhPMyAdmin. Using NaviCat or updating my PhPMyAdmin resolved the issue. Answer points go to Brad!


Only top voted, non community-wiki answers of a minimum length are eligible