记一次数据库存储引擎转换:MyISAM转InnoDB

控制台登录服务器

登录mysql:

mysql -uroot -p
屏显:

[root@VM_0_10_centos ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 182
Server version: 5.5.62 Source distribution

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

显示所有数据库:

mysql> show databases;
屏显:

+--------------------+
| Database           |
+--------------------+
| pro                |
| reseed             |
+--------------------+

进入reseed数据库:

mysql> use reseed

显示当前数据库所有表

mysql> show tables;
屏显:

+------------------+
| Tables_in_reseed |
+------------------+
| error_torrents   |
| historys         |
| sites            |
| torrent_pieces   |
| torrent_records  |
| torrent_search   |
| torrents         |
| totp             |
| users            |
+------------------+
9 rows in set (0.02 sec)

转换前为了解决警告:ERROR 2006 (HY000): MySQL server has gone away,可以执行:
set global max_allowed_packet=1024*1024*16;

转换存储引擎:

ALTER TABLE torrent_records ENGINE=INNODB;
ALTER TABLE torrent_pieces ENGINE=INNODB;
ALTER TABLE torrents ENGINE=INNODB;
ALTER TABLE torrent_search ENGINE=INNODB;

屏显:

mysql> ALTER TABLE torrent_records ENGINE=INNODB;
Query OK, 2306734 rows affected (5 min 28.94 sec)
Records: 2306734  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE torrent_pieces ENGINE=INNODB;
Current database: reseed
Query OK, 1551854 rows affected (1 min 43.50 sec)
Records: 1551854  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE torrents ENGINE=INNODB;
最后修改:2020 年 02 月 29 日 03 : 22 PM
如果觉得我的文章对你有用,请随意赞赏

发表评论