-1

I will be importing a MySQL dump from another host with lots of DBs in it to the new server I just set up with VestaCP. Since that seems to overwrite everything on the current one should I keep the current mysql tables or any other of the ones vesta creates?

If not where I should update the root password which is different in the dump i will be importing?

3
  • 1
    You're going to have to clarify. Are you dumping all databases including the mysql database (the one containing meta data)? What are your dump commands? And what is your intention? You're moving your databases to another server?
    – Halfgaar
    Nov 25, 2014 at 19:50
  • yes. I'm doing mysqldump -u root -p -QqeR --add-drop-table --all-databases | bzip2 -v9 - > siteData.sql.bz2 The idea is to move all the databases to a new server, where i've rsynced the site files already with the final intent everything to work without changing db users, passwords or whatever since we are talking 100+ sites here. The old host was using no CP, the new one VestaCP.
    – user240891
    Nov 26, 2014 at 10:02
  • You should edit your post with the extra information. You should also specify which distribution you're moving from and to.
    – Halfgaar
    Nov 26, 2014 at 10:57

1 Answer 1

0

You didn't specify which distribution, so this is for Debian-based:

If you import everything, including the 'mysql' database and restart MySQL, you will have imported (and overwritten!) users from your old DB as well, as you stated. There are several things to keep in mind:

  • Test it.
  • Use long options when posting here. --events and --routines is clearer that -R and -E (the latter you missed).
  • if you have a ~/.my.cnf or any other config file which specifies the (root) password, change it.
  • /etc/mysql/debian/cnf contains the user account that the debian package manager uses to maintain your database server. That password will no longer work, so you will have to copy the password from that file on your old server. If your old server was not Debian-based and there is no debian-sys-maint account, you may need to create one with SUPER privileges.

I don't know what VestaCP does. You may want to dump its DB first and re-import it after your transfer.

3
  • Ah good points, make it much more clearer. I migrate from CentOS to Ubuntu I guess would be easier to import everything but the mysql db, and then manually export everything but the root users from it and import to the fresh mysql one?
    – user240891
    Nov 26, 2014 at 13:15
  • That's possible, but you also have to import the grants. It can get tricky.
    – Halfgaar
    Nov 26, 2014 at 13:19
  • Is there a way to merge them then? What would be the easiest way you suggest?
    – user240891
    Nov 26, 2014 at 16:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .