Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
added 43 characters in body
Source Link
rush
  • 2k
  • 2
  • 17
  • 23

IfThis way does NOT work in case of Innodb. If Mysql versions are the same, you can try to move files from /var/lib/mysql (depends on your distributive) from one vps to another.
For example in Debian GNU/Linux this will work, but you'll also need to change debian-sys-maint mysql user's password. you can do it this way:
mysql -uroot -p -e "GRANT ALL PRIVILEGES ON . TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '$(sed -n '/password/p;' /etc/mysql/debian.cnf | sed '1d;s/.* //')' WITH GRANT OPTION;"
In case you have different minor mysql version it might work, but theoretically you can have some bugs.

If Mysql versions are the same, you can try to move files from /var/lib/mysql (depends on your distributive) from one vps to another.
For example in Debian GNU/Linux this will work, but you'll also need to change debian-sys-maint mysql user's password. you can do it this way:
mysql -uroot -p -e "GRANT ALL PRIVILEGES ON . TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '$(sed -n '/password/p;' /etc/mysql/debian.cnf | sed '1d;s/.* //')' WITH GRANT OPTION;"
In case you have different minor mysql version it might work, but theoretically you can have some bugs.

This way does NOT work in case of Innodb. If Mysql versions are the same, you can try to move files from /var/lib/mysql (depends on your distributive) from one vps to another.
For example in Debian GNU/Linux this will work, but you'll also need to change debian-sys-maint mysql user's password. you can do it this way:
mysql -uroot -p -e "GRANT ALL PRIVILEGES ON . TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '$(sed -n '/password/p;' /etc/mysql/debian.cnf | sed '1d;s/.* //')' WITH GRANT OPTION;"
In case you have different minor mysql version it might work, but theoretically you can have some bugs.

Source Link
rush
  • 2k
  • 2
  • 17
  • 23

If Mysql versions are the same, you can try to move files from /var/lib/mysql (depends on your distributive) from one vps to another.
For example in Debian GNU/Linux this will work, but you'll also need to change debian-sys-maint mysql user's password. you can do it this way:
mysql -uroot -p -e "GRANT ALL PRIVILEGES ON . TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '$(sed -n '/password/p;' /etc/mysql/debian.cnf | sed '1d;s/.* //')' WITH GRANT OPTION;"
In case you have different minor mysql version it might work, but theoretically you can have some bugs.