Works faster and more reliably than through phpmyadmin and with databases of any size.
On large databases, in order not to crash the server, we use the configuration
mysqldump -u USER -p –single-transaction –quick –lock-tables=false DATABASE | gzip > OUTPUT.gz
- Go to the client’s SSH server
- Test Mysql connection mysql -u [DB_username] -p (will ask for password)
- See if the user is the right one (list of databases) show databases;
- Checking the availability of free space on the client’s hosting (if possible)
- Go to the directory where we want to get the dump
- Dumping mysqldump -u [Username] -p [DBname] > [filename].sql (it will ask for a password and silently start working. That is, you have to wait until the BASH prompt appears to enter – it means the file is ready)
- Copy the created file to the development server in the folder /var/www/html/storage/db
- Go to phpmyadmin on the development server
- Rename the target database if it exists, adding the index _1, _2 or the next one after its name CAREFULLY! through the section Operations
- Create a database user (as in hosting)
- When creating a user, check the box “Create database with same name and grant all privileges.”
- Create a new database with the desired name (home section) – the encoding of the new database must be the same as that of the copied one!!
- Go to the created database in the Privileges section and check that the user with the name of this database has full access to it
- SSH into the development server
- Go to the folder /var/www/html/storage/db
- Run the command mysql -u [DBUsername] -p [DBName] < [filename].sql if everything is OK, you will have to wait similarly to step 7
- Checking the database with phpmyadmin
- Checking site performance
- Remove the database you made in step 9.