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:52] – [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 | + | * **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 (~/ |
- | * Start mysql server again (downtime was 10-15 minutes) | + | * Start mysql server again (downtime was 10-15 minutes) |
- | * 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 | + | * **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) |
- | * move contents of mysqldata to the datadir | + | * move contents of mysqldata to the datadir |
- | * 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 496: | Line 507: | ||
* [[development: | * [[development: | ||
* [[development: | * [[development: | ||
+ | * [[development: | ||
* [[development: | * [[development: | ||
* [[development: | * [[development: | ||
Line 501: | Line 513: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[development: | ||
+ | * [[development: |
development/database/mysql.1722952356.txt.gz · Last modified: 2024/08/06 13:52 by tungnt