MySQL backup
  1. Forums
  2. CloudLinux and Control Panels
  3. CloudLinux and cPanel
  1. Fernando Barajas
  2. Saturday, 30 May 2015
  3.  Subscribe via email
Backup instructions on manual
Rate this post:
  1. 30.05.2015 13:05:46
  2. # 1
Fernando Barajas Accepted Answer
Posts: 3
Joined: 07.05.2015
Hi!  I'm reading the backup instructions:

$ mkdir -p ~/mysqlbkp
$ service mysql restart --skip-networking --skip-grant-tables
$ mysql_upgrade
$ mysqldump --all-databases --routines --triggers > ~/mysqlbkp/dbcopy.sql
$ service mysql stop
$ cp -r /var/lib/mysql/mysql ~/mysqlbkp/
$ service mysql start

Isn't this redundant?  As far as I understand, with the mysqldump command, you're backing all the databases, and then with the cp -r command you are backing them again, isn't it?

If so, since I don't have that much space for a dual backup, which one would be a better option?

  1. 30.05.2015 19:05:56
  2. # 2
Fernando Barajas Accepted Answer
Posts: 3
Joined: 07.05.2015
While running mysql_upgrade, I get the following error:

Running 'mysql_fix_privilege_tables'...
ERROR 1062 (23000) at line 708: Duplicate entry 't1rue2kea3dv-wwwtrue_true' for key 'PRIMARY'
FATAL ERROR: Upgrade failed

How can I fix that?

  1. 03.06.2015 08:06:03
  2. # 3
Bogdan Accepted Answer
Posts: 709
Joined: 26.06.2013
Hello Fernando.

In backup documentation we do dump all databases, however copy only system \'mysql\' database. As far as we know privileges are not dumped properly with mysqldump so better to have system database as is.

The error after mysql_upgrade means that most probably someone did a database backup with just copying database name to /var/lib/mysql/t1rue2kea3dv-wwwtrue_true , and most probably there are duplicate keys in it. Please move out that directory from /var/lib/mysql and run \'mysql_upgrade\' again.
  • Page :
  • 1

There are no replies made for this post yet.
Be one of the first to reply to this post!
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below. Supports gif,jpg,png,zip,rar,pdf
• Insert • Remove Upload Files (Maximum File Size: 2 MB)
To protect the site from bots and unauthorized scripts, we require that you enter the captcha codes below before posting your question.