development:database:mysql
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
development:database:mysql [2024/08/06 13:50] – [4.3. Copy table từ file .ibd] tungnt | development:database:mysql [2025/03/19 04:14] (current) – [Kiểm tra thư mục dữ liệu] tungnt | ||
---|---|---|---|
Line 190: | Line 190: | ||
</ | </ | ||
+ | ==== Kiểm tra thư mục dữ liệu ==== | ||
+ | |||
+ | <code sql> | ||
+ | SHOW VARIABLES LIKE ' | ||
+ | </ | ||
+ | |||
+ | ==== Kiểm tra dung lượng bảng đã đánh partition ==== | ||
+ | |||
+ | <code sql> | ||
+ | SELECT TABLE_NAME, PARTITION_NAME, | ||
+ | </ | ||
====== 2. Tạo tài khoản và phân quyền MySQL ====== | ====== 2. Tạo tài khoản và phân quyền MySQL ====== | ||
Line 222: | Line 233: | ||
<file sql> | <file sql> | ||
- | mysql> CREATE USER ' | + | mysql> CREATE USER ' |
Query OK, 0 rows affected (0.10 sec) | Query OK, 0 rows affected (0.10 sec) | ||
Line 477: | Line 488: | ||
**Tham khảo:** https:// | **Tham khảo:** https:// | ||
- | < | + | **I recently moved a 30GB database with the following stragegy:** |
- | I recently moved a 30GB database with the following stragegy: | + | |
- | * Old Server | + | |
* Stop mysql server | * Stop mysql server | ||
* Copy contents of datadir to another location on disk (~/ | * Copy contents of datadir to another location on disk (~/ | ||
Line 486: | Line 496: | ||
* compress the data (tar -czvf mysqldata.tar.gz ~/ | * compress the data (tar -czvf mysqldata.tar.gz ~/ | ||
* copy the compressed file to new server | * copy the compressed file to new server | ||
- | * New Server | + | |
* install mysql (don't start) | * install mysql (don't start) | ||
* unzip compressed file (tar -xzvf mysqldata.tar.gz) | * unzip compressed file (tar -xzvf mysqldata.tar.gz) | ||
Line 492: | Line 502: | ||
* Make sure your innodb_log_file_size is same on new server, or if it's not, don't copy the old log files (mysql will generate these) | * Make sure your innodb_log_file_size is same on new server, or if it's not, don't copy the old log files (mysql will generate these) | ||
* Start mysql | * Start mysql | ||
- | </ | ||
====== 5. Tham khảo ====== | ====== 5. Tham khảo ====== | ||
Line 498: | Line 507: | ||
* [[development: | * [[development: | ||
* [[development: | * [[development: | ||
+ | * [[development: | ||
* [[development: | * [[development: | ||
* [[development: | * [[development: | ||
Line 503: | Line 513: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[development: | ||
+ | * [[development: |
development/database/mysql.1722952223.txt.gz · Last modified: 2024/08/06 13:50 by tungnt