Alanaktion / phproject

A high performance full-featured project management system
https://www.phproject.org
GNU General Public License v3.0
384 stars 106 forks source link

How to dump and restore MySQL DB? #408

Closed daitepiva closed 1 year ago

daitepiva commented 2 years ago

I'm moving my site to another hosting but I can't copy my old DB because of VIEW tables in MySQL. I created dump of my old DB and imported it by phpMyAdmin but I got an error message: /!50001 CREATE ALGORITHM=UNDEFINED / /!50013 DEFINER=pro@localhost SQL SECURITY DEFINER / /!50001 VIEW issue_comment_detail AS (select c.id AS id,c.issue_id AS issue_id,c.user_id AS user_id,c.text AS text,c.file_id AS file_id,c.created_date AS created_date,u.username AS user_username,u.email AS user_email,u.name AS user_name,u.role AS user_role,u.task_color AS user_task_color,f.filename AS file_filename,f.filesize AS file_filesize,f.content_type AS file_content_type,f.downloads AS file_downloads,f.created_date AS file_created_date,f.deleted_date AS file_deleted_date,i.deleted_date AS issue_deleted_date from (((issue_comment c join user u on((c.user_id = u.id))) left join issue_file f on((c.file_id = f.id))) join issue i on((i.id = c.issue_id)))) / MySQL said: 

1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation

I created this VIEW manually but my site is empty. So how should I copy my DB from one hosting to another?

Alanaktion commented 2 years ago

If you're using mysqldump to export, you can try adding the --skip-definer option to export the database which may resolve the issue. Otherwise, I would try removing the DEFINER=pro@localhost SQL SECURITY DEFINER lines from the exported file and import that modified file.

daitepiva commented 2 years ago

If you're using mysqldump to export, you can try adding the --skip-definer option to export the database which may resolve the issue. Otherwise, I would try removing the DEFINER=pro@localhost SQL SECURITY DEFINER lines from the exported file and import that modified file.

mysqldump: unknown option '--skip-definer'

I removed all lines with "DEFINER=..." and then my dump was imported w/o errors. Now my site looks good. Thank you :-)