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:48] – [1.4. Update AUTO_INCREMENT] 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 474: | Line 485: | ||
3 rows in set (0.01 sec) | 3 rows in set (0.01 sec) | ||
</ | </ | ||
- | **Tham khảo | + | |
+ | **Tham khảo:** https:// | ||
+ | |||
+ | **I recently moved a 30GB database with the following stragegy: | ||
+ | |||
+ | * **Old Server** | ||
+ | * Stop mysql server | ||
+ | * Copy contents of datadir to another location on disk (~/ | ||
+ | * Start mysql server again (downtime was 10-15 minutes) | ||
+ | * compress the data (tar -czvf mysqldata.tar.gz ~/ | ||
+ | * copy the compressed file to new server | ||
+ | * **New Server** | ||
+ | * install mysql (don't start) | ||
+ | * unzip compressed file (tar -xzvf mysqldata.tar.gz) | ||
+ | * 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) | ||
+ | * Start mysql | ||
====== 5. Tham khảo ====== | ====== 5. Tham khảo ====== | ||
Line 480: | Line 507: | ||
* [[development: | * [[development: | ||
* [[development: | * [[development: | ||
+ | * [[development: | ||
* [[development: | * [[development: | ||
* [[development: | * [[development: | ||
Line 485: | Line 513: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[development: | ||
+ | * [[development: |
development/database/mysql.1722952095.txt.gz · Last modified: 2024/08/06 13:48 by tungnt