+3 votes
Hi all, I have a mysql database of 670 mb. Installed on Ubuntu 18. There was a move to a new server and the dump took a long time to load. Here is the console view https://cloud.mail.ru/public/3hPj/3neoXmPjV

Running the commandMysql -v -u root -p main_data < /tmp/dump....sql

What could be wrong? How to speed it up?
Try adding such keys to the mysql command...

--add-locks is an option that adds LOCK TABLES before execution and UNLOCK TABLE after each table dump. It is used to speed up MySQL access;

The --quick and --opt options are recommended if the MySQL database is too large to fit entirely in memory.

3 Answers

0 votes
Best answer
Do not create indexes before adding data.
A typical database dump consists of two sections:
1. database structure
2. database data
The database structure creates tables: their fields and indices.
You need to cut the code of these indexes and add the creation of the indexes to the end of the dump.
Then the speed of importing the dump will increase by 50 times.
The speed is also affected by the type of tables - myisam is faster than innodb.
0 votes
It is faster to move the database directory with rsinkom or mariabackup (if you have mariadb)
0 votes
670 mb shouldn't fill up fast =)
N No. The size was the same) Where to look config? Here etcmysqlmysql.conf.dmysqld.cnf? What kind of parameters should be? Maybe it affects it:

key_buffer_size		= 16M
max_allowed_packet = 16M
query_cache_limit = 1M
query_cache_size = 16M
Dos So as not to describe here, for example, here is an article on how to configure MySQL to use:

And here you can find ready (approximate) configurations for a particular amount of memory on the server:
Check the configuration of MySQL itself...how much is allocated to it...as an option...
Dos Maybe the DB used to be smaller? :)
Yes, but it was faster before.
Maybe the server is not that fast, maybe it is busy with something. You have to watch.