中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

aspx網(wǎng)站開(kāi)發(fā) 案例網(wǎng)站代運(yùn)營(yíng)推廣

aspx網(wǎng)站開(kāi)發(fā) 案例,網(wǎng)站代運(yùn)營(yíng)推廣,網(wǎng)頁(yè)設(shè)計(jì)作業(yè)怎么做網(wǎng)站,用wordpress做的外貿(mào)網(wǎng)站文章目錄 MySQL 8.0 InnoDB Tablespaces之General Tablespaces(通用表空間/一般表空間)General tablespaces(通用表空間/一般表空間)通用表空間的功能通用表空間的限制 創(chuàng)建通用表空間(一般表空間)創(chuàng)建語(yǔ)法…

文章目錄

  • MySQL 8.0 InnoDB Tablespaces之General Tablespaces(通用表空間/一般表空間)
    • General tablespaces(通用表空間/一般表空間)
      • 通用表空間的功能
      • 通用表空間的限制
    • 創(chuàng)建通用表空間(一般表空間)
      • 創(chuàng)建語(yǔ)法
      • 創(chuàng)建通用表空間
        • 例1:不指定數(shù)據(jù)文件路徑
        • 例2: 省略add datafile語(yǔ)句
        • 例3:創(chuàng)建datadir路徑外的表空間
          • innodb_directories變量參數(shù)
          • 例:創(chuàng)建datadir路徑外的表空間
            • 修改innodb_directories變量參數(shù)
            • 創(chuàng)建datadir路徑外的表空間
        • 例4:創(chuàng)建InnoDB通用表空間的限制
    • 通用表空間中的表
      • 例1:創(chuàng)建表指定通用表空間
      • 例2:修改表的表空間
        • 例2-1:修改到不同的通用表空間中
        • 例2-2:修改表從獨(dú)立表空間或系統(tǒng)表空間到通用表空間
        • 例2-3:修改表從通用表空間或系統(tǒng)表空間到獨(dú)立表空間
        • 例2-4:修改表從通用表空間或獨(dú)立表空間到系統(tǒng)表空間
    • 參考

【免責(zé)聲明】文章僅供學(xué)習(xí)交流,觀點(diǎn)代表個(gè)人,與任何公司無(wú)關(guān)。
編輯|SQL和數(shù)據(jù)庫(kù)技術(shù)(ID:SQLplusDB)

MySQL 8.0 OCP (1Z0-908) 考點(diǎn)概要

MySQL 8.0 OCP (1Z0-908) 考點(diǎn)精析-安裝與配置考點(diǎn)1:設(shè)置系統(tǒng)變量
【MySQL】控制MySQL優(yōu)化器行為方法之optimizer_switch系統(tǒng)變量
【MySQL】MySQL系統(tǒng)變量(system variables)列表(mysqld --verbose --help的結(jié)果例)
【MySQL】MySQL系統(tǒng)變量(system variables)列表(SHOW VARIABLES 的結(jié)果例)
MySQL 8.0 OCP (1Z0-908) 考點(diǎn)精析-備份與恢復(fù)考點(diǎn)1:MySQL Enterprise Backup概要
MySQL 8.0 OCP (1Z0-908) 考點(diǎn)精析-性能優(yōu)化考點(diǎn)1:sys.statement_analysis視圖
MySQL 8.0 OCP (1Z0-908) 考點(diǎn)精析-性能優(yōu)化考點(diǎn)2:系統(tǒng)變量的確認(rèn)
MySQL 8.0 OCP (1Z0-908) 考點(diǎn)精析-性能優(yōu)化考點(diǎn)3:EXPLAIN ANALYZE
MySQL 8.0 OCP (1Z0-908) 考點(diǎn)精析-性能優(yōu)化考點(diǎn)4:慢速查詢?nèi)罩?#xff08;slow query log)
MySQL 8.0 OCP (1Z0-908) 考點(diǎn)精析-性能優(yōu)化考點(diǎn)5:表連接算法(join algorithm)
MySQL 8.0 OCP (1Z0-908) 考點(diǎn)精析-性能優(yōu)化考點(diǎn)6:MySQL Enterprise Monitor之Query Analyzer
MySQL 8.0 OCP (1Z0-908) 考點(diǎn)精析-架構(gòu)考點(diǎn)1:二進(jìn)制日志文件(Binary log)
MySQL 8.0 OCP (1Z0-908) 考點(diǎn)精析-架構(gòu)考點(diǎn)5:數(shù)據(jù)字典(Data Dictionary)
MySQL 8.0 OCP (1Z0-908) 考點(diǎn)精析-架構(gòu)考點(diǎn)6:InnoDB Tablespaces之系統(tǒng)表空間(System Tablespace)
MySQL 8.0 InnoDB Tablespaces之File-per-table tablespaces(單獨(dú)表空間)

MySQL 8.0 InnoDB Tablespaces之General Tablespaces(通用表空間/一般表空間)

InnoDB表空間是MySQL中用于存儲(chǔ)InnoDB存儲(chǔ)引擎表數(shù)據(jù)和索引的物理文件。
InnoDB Architecture
InnoDB表空間根據(jù)用途可以分成多種類型:

  • 數(shù)據(jù)表空間:
    • System tablespace(系統(tǒng)表空間)
    • File-per-table tablespaces(單獨(dú)表空間)
    • General tablespaces(通用表空間/一般表空間)
  • Undo 表空間
  • 臨時(shí)表空間(Temporary table tablespaces)

General tablespaces(通用表空間/一般表空間)

通用表空間具有如下功能和限制。

通用表空間的功能

通用表空間具有如下功能:

  • 使用CREATE TABLESPACE語(yǔ)法創(chuàng)建的共享InnoDB表空間(與Oracle的表空間很相似)。
  • 類似于系統(tǒng)表空間,通用表空間是共享表空間,可以存儲(chǔ)多個(gè)表的數(shù)據(jù)。 與獨(dú)立表空間相比,通用表空間具有潛在的內(nèi)存優(yōu)勢(shì)。(通用表空間中多個(gè)表共享一個(gè)表空間,所以消耗更少的內(nèi)存用于表空間元數(shù)據(jù),獨(dú)立表空間需要更多內(nèi)存用于表空間元數(shù)據(jù)。)
  • 數(shù)據(jù)文件可以放置在與MySQL數(shù)據(jù)目錄( MySQL data directory)相關(guān)或獨(dú)立的目錄中。
  • 通用表空間支持所有的表行格式和相關(guān)功能(REDUNDANT, COMPACT, DYNAMIC, COMPRESSED)。 CREATE
  • TABLE語(yǔ)句可以使用TABLESPACE選項(xiàng)在通用表空間、獨(dú)立表空間或系統(tǒng)表空間中創(chuàng)建表。 ALTER
  • TABLE語(yǔ)句可以使用TABLESPACE選項(xiàng)在通用表空間、獨(dú)立表空間或系統(tǒng)表空間之間移動(dòng)表。
  • 創(chuàng)建通用表空間時(shí)候會(huì)生成相應(yīng)的.ibd數(shù)據(jù)文件。 通用表空間不屬于特定的數(shù)據(jù)庫(kù)。

通用表空間的限制

通用表空間具有如下限制:

  • 無(wú)法將現(xiàn)有的表空間更改為通用表空間。
  • 不支持創(chuàng)建臨時(shí)通用表空間。
  • 通用表空間不支持臨時(shí)表。
  • 與系統(tǒng)表空間類似,truncate 或者drop通用表空間中的表,僅釋放系統(tǒng)表空間中的空間,不會(huì)返回給操作系統(tǒng)。
  • 表復(fù)制的ALTER TABLE操作可能會(huì)增加表空間使用的空間量。
  • 不支持表分區(qū)(table partitions)放置在通用表空間中
  • 源和副本位于同一主機(jī)上的復(fù)制環(huán)境中,不支持使用ADD DATAFILE子句。
  • MySQL 8.0.21開(kāi)始,由datadir、innodb_data_home_dir和innodb_directories變量定義的目錄以外,無(wú)法在撤銷表空間目錄(innodb_undo_directory)中創(chuàng)建通用表空間。

創(chuàng)建通用表空間(一般表空間)

創(chuàng)建語(yǔ)法

通用表空間/一般表空間創(chuàng)建語(yǔ)法如下:

CREATE [UNDO] TABLESPACE tablespace_nameInnoDB and NDB:[ADD DATAFILE 'file_name'][AUTOEXTEND_SIZE [=] value]InnoDB only:[FILE_BLOCK_SIZE = value][ENCRYPTION [=] {'Y' | 'N'}]NDB only:USE LOGFILE GROUP logfile_group[EXTENT_SIZE [=] extent_size][INITIAL_SIZE [=] initial_size][MAX_SIZE [=] max_size][NODEGROUP [=] nodegroup_id][WAIT][COMMENT [=] 'string']InnoDB and NDB:[ENGINE [=] engine_name]Reserved for future use:[ENGINE_ATTRIBUTE [=] 'string']

創(chuàng)建通用表空間

例1:不指定數(shù)據(jù)文件路徑

可以不指定數(shù)據(jù)文件路徑創(chuàng)建通用表空間,這時(shí)候數(shù)據(jù)文件會(huì)默認(rèn)創(chuàng)建在datadir路徑下。

創(chuàng)建表空間:

mysql> create tablespace test_tbs1 add datafile 'test_tbs1.ibd';
Query OK, 0 rows affected (0.01 sec)mysql> show variables like 'datadir';
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| datadir       | /var/lib/mysql/ |
+---------------+-----------------+
1 row in set (0.01 sec)mysql> select * from-> information_schema.innodb_tablespaces t-> join information_schema.innodb_datafiles d-> on t.SPACE=d.SPACE-> where t.NAME ='test_tbs1'\G
*************************** 1. row ***************************SPACE: 81NAME: test_tbs1FLAG: 18432ROW_FORMAT: AnyPAGE_SIZE: 16384ZIP_PAGE_SIZE: 0SPACE_TYPE: GeneralFS_BLOCK_SIZE: 4096FILE_SIZE: 114688ALLOCATED_SIZE: 114688
AUTOEXTEND_SIZE: 0SERVER_VERSION: 8.0.35SPACE_VERSION: 1ENCRYPTION: NSTATE: normalSPACE: 0x3831PATH: test_tbs1.ibd
1 row in set (0.00 sec)mysql>

查看數(shù)據(jù)文件:

root@mysql-vm:/var/lib/mysql# ls -l test_tbs*
-rw-r----- 1 mysql mysql 114688 Dec 20 20:32 test_tbs1.ibd
例2: 省略add datafile語(yǔ)句

MySQL 8.0.14版本之后,創(chuàng)建表空間時(shí)可以省略add datafile語(yǔ)句。這時(shí)MySQL會(huì)隱式創(chuàng)建具有唯一文件名的表空間數(shù)據(jù)文件。

  • 文件名是一個(gè)128位的UUID,格式為五組用破折號(hào)分隔的十六進(jìn)制數(shù)字(aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee)。
  • 常規(guī)表空間數(shù)據(jù)文件包括一個(gè).ibd文件擴(kuò)展名。 在replication環(huán)境中,在源上創(chuàng)建的數(shù)據(jù)文件名與在復(fù)制副本上創(chuàng)建的文件名不同。

例:

mysql>  create tablespace test_tbs2;
Query OK, 0 rows affected (0.01 sec)
mysql> select * from-> information_schema.innodb_tablespaces t-> join information_schema.innodb_datafiles d-> on t.SPACE=d.SPACE-> where t.NAME ='test_tbs2'\G
*************************** 1. row ***************************SPACE: 82NAME: test_tbs2FLAG: 18432ROW_FORMAT: AnyPAGE_SIZE: 16384ZIP_PAGE_SIZE: 0SPACE_TYPE: GeneralFS_BLOCK_SIZE: 4096FILE_SIZE: 114688ALLOCATED_SIZE: 114688
AUTOEXTEND_SIZE: 0SERVER_VERSION: 8.0.35SPACE_VERSION: 1ENCRYPTION: NSTATE: normalSPACE: 0x3832PATH: af5bb7e2-9f34-11ee-8d33-525400b409f6.ibd
1 row in set (0.00 sec)mysql>

查看數(shù)據(jù)文件:

root@mysql-vm:/var/lib/mysql# ls -l af5bb7e2-9f34-11ee-8d33-525400b409f6.ibd
-rw-r----- 1 mysql mysql 114688 Dec 20 20:38 af5bb7e2-9f34-11ee-8d33-525400b409f6.ibd
root@mysql-vm:/var/lib/mysql#
例3:創(chuàng)建datadir路徑外的表空間

通用表空間數(shù)據(jù)文件可以放置在數(shù)據(jù)目錄之外的位置,但是路徑必須是innodb_directories的值或者附加到innodb_directories值的變量(innodb_data_home_dir、innodb_undo_directory和datadir)之一。

innodb_directories變量參數(shù)

innodb_directories變量參數(shù)內(nèi)容如下:

Command-Line Format–innodb-directories=dir_name
System Variableinnodb_directories
ScopeGlobal
DynamicNo
SET_VAR Hint AppliesNo
TypeDirectory name
Default ValueNULL

innodb_directories參數(shù)的默認(rèn)值為NULL。但是innodb_data_home_dir、innodb_undo_directory和datadir定義的目錄會(huì)會(huì)附加到innodb_directories參數(shù)值上。

例:

mysql> show variables like 'innodb_directories';
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| innodb_directories |       |
+--------------------+-------+
1 row in set (0.01 sec)mysql> show variables like 'innodb_data_home_dir';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| innodb_data_home_dir |       |
+----------------------+-------+
1 row in set (0.00 sec)mysql> show variables like 'innodb_undo_directory';
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| innodb_undo_directory | ./    |
+-----------------------+-------+
1 row in set (0.01 sec)mysql> show variables like 'datadir';
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| datadir       | /var/lib/mysql/ |
+---------------+-----------------+
1 row in set (0.00 sec)mysql>

/var/lib/mysql-files
drwx------ 12 mysql mysql 4096 Dec 24 22:10 mysql

參考:
https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_directories

修改innodb_directories變量參數(shù)需要修改MySQL配置文件,并重新啟動(dòng)MySQL服務(wù)。

例:創(chuàng)建datadir路徑外的表空間

如果在未定義路徑中創(chuàng)建通用表空間,由于不是已知目錄,會(huì)發(fā)生如下ERROR 3121 (HY000)錯(cuò)誤。

mysql> show variables like 'innodb_directories';
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| innodb_directories |       |
+--------------------+-------+
1 row in set (0.01 sec)mysql> create tablespace sqlplusdb_tb1 add datafile '/var/lib/mysql-files/sqlplusdb_tb1.ibd';
ERROR 3121 (HY000): The DATAFILE location must be in a known directory.
mysql>

可以通過(guò)修改innodb_directories變量參數(shù)添加已知目錄。

修改innodb_directories變量參數(shù)

添加如下內(nèi)容(innodb_directories=/var/lib/mysql-files)到MySQL配置文件中。
例:innodb_directories=/var/lib/mysql-files

root@mysql-vm:/etc/mysql# vi /etc/mysql/mysql.conf.d/mysqld.cnf
root@mysql-vm:/etc/mysql# systemctl stop mysql
root@mysql-vm:/etc/mysql# systemctl start mysql
創(chuàng)建datadir路徑外的表空間

查看變量并創(chuàng)建datadir路徑外的表空間的表空間

mysql> show variables like 'innodb_directories';
+--------------------+----------------------+
| Variable_name      | Value                |
+--------------------+----------------------+
| innodb_directories | /var/lib/mysql-files |
+--------------------+----------------------+
1 row in set (0.00 sec)mysql> create tablespace test_tb3 add datafile '/var/lib/mysql-files/test_tb3.ibd';
Query OK, 0 rows affected (0.02 sec)
mysql>
mysql> select * from->  information_schema.innodb_tablespaces t->  join information_schema.innodb_datafiles d->  on t.SPACE=d.SPACE->  where t.NAME ='test_tb3'\G
*************************** 1. row ***************************SPACE: 92NAME: test_tb3FLAG: 18432ROW_FORMAT: AnyPAGE_SIZE: 16384ZIP_PAGE_SIZE: 0SPACE_TYPE: GeneralFS_BLOCK_SIZE: 4096FILE_SIZE: 114688ALLOCATED_SIZE: 114688
AUTOEXTEND_SIZE: 0SERVER_VERSION: 8.0.35SPACE_VERSION: 1ENCRYPTION: NSTATE: normalSPACE: 0x3932PATH: /var/lib/mysql-files/test_tb3.ibd
1 row in set (0.00 sec)mysql>

參考:
MySQL 8.0 OCP (1Z0-908) 考點(diǎn)精析-安裝與配置考點(diǎn)1:設(shè)置系統(tǒng)變量

例4:創(chuàng)建InnoDB通用表空間的限制

可以在數(shù)據(jù)目錄(datadir)中創(chuàng)建通用表空間。

mysql> create tablespace sqlplusdb_tb1 add datafile '/var/lib/mysql/sqlplusdb_tb1.ibd';
Query OK, 0 rows affected (0.02 sec)

但是為了避免與隱式創(chuàng)建的每個(gè)表一個(gè)文件的表空間發(fā)生沖突,不支持在數(shù)據(jù)目錄(datadir)的子目錄中創(chuàng)建InnoDB通用表空間。
如果在數(shù)據(jù)目錄(datadir)的子目錄中創(chuàng)建InnoDB通用表空間會(huì)報(bào)ERROR 3121 (HY000)錯(cuò)誤。

例:

mysql> show variables like 'datadir';
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| datadir       | /var/lib/mysql/ |
+---------------+-----------------+
1 row in set (0.00 sec)mysql> create tablespace sqlplusdb_tb2 add datafile '/var/lib/mysql/testdb/sqlplusdb_tb1.ibd';
ERROR 3121 (HY000): The DATAFILE location cannot be under the datadir.
mysql>

通用表空間中的表

和Oracle一樣,MySQL在創(chuàng)建表時(shí)可以指定表空間也可以修改表的表空間。

例1:創(chuàng)建表指定通用表空間

mysql> use testdb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> CREATE TABLE test_t1 (c1 INT) TABLESPACE test_tbs1 ;
Query OK, 0 rows affected (0.01 sec)mysql>
mysql> SHOW CREATE TABLE  test_t1;
+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table   | Create Table                                                                                                                                           |
+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| test_t1 | CREATE TABLE `test_t1` (`c1` int DEFAULT NULL
) /*!50100 TABLESPACE `test_tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.02 sec)mysql>
mysql> select->      name as 'table_name',->      space_type->  from->      information_schema.innodb_tables->  where->      name like '%test_t1%' \g
+----------------+------------+
| table_name     | space_type |
+----------------+------------+
| testdb/test_t1 | General    |
+----------------+------------+
1 row in set (0.08 sec)

例2:修改表的表空間

通過(guò)ALTER TABLE語(yǔ)句的TABLESPACE選項(xiàng)可以修改表的表空間,將表在通用表空間、獨(dú)立表空間或系統(tǒng)表空間之間進(jìn)行移動(dòng)。

需要注意的是:

- ALTER TABLE ... TABLESPACE操作將導(dǎo)致對(duì)表進(jìn)行全表重建(即使TABLESPACE屬性未發(fā)生更改也會(huì)重建)。
- ALTER TABLE ... TABLESPACE語(yǔ)法不支持將表從臨時(shí)表空間移動(dòng)到持久表空間。
例2-1:修改到不同的通用表空間中

通過(guò)ALTER TABLE tbl_name TABLESPACE [=] tablespace_name修改表到不同的通用表空間中

例:

mysql> SHOW CREATE TABLE  test_t1;
+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table   | Create Table                                                                                                                                           |
+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| test_t1 | CREATE TABLE `test_t1` (`c1` int DEFAULT NULL
) /*!50100 TABLESPACE `test_tbs1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
+---------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)mysql> ALTER TABLE test_t1 tablespace=sqlplusdb_tb1;
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0mysql> SHOW CREATE TABLE  test_t1;
+---------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table   | Create Table                                                                                                                                               |
+---------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test_t1 | CREATE TABLE `test_t1` (`c1` int DEFAULT NULL
) /*!50100 TABLESPACE `sqlplusdb_tb1` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
+---------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)mysql>
例2-2:修改表從獨(dú)立表空間或系統(tǒng)表空間到通用表空間

可以通過(guò)如下命令修改表從獨(dú)立表空間或系統(tǒng)表空間到通用表空間。

ALTER TABLE tbl_name TABLESPACE [=] tablespace_name

例:修改表從獨(dú)立表空間到通用表空間

mysql> select->      name as 'table_name',->      space_type->  from->      information_schema.innodb_tables->  where->      name ='testdb/test_file_pertable_tablespace' \g
+--------------------------------------+------------+
| table_name                           | space_type |
+--------------------------------------+------------+
| testdb/test_file_pertable_tablespace | Single     |
+--------------------------------------+------------+
1 row in set (0.00 sec)mysql> alter table test_file_pertable_tablespace tablespace=test_tbs1;
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0mysql> select->      name as 'table_name',->      space_type->  from->      information_schema.innodb_tables->  where->      name ='testdb/test_file_pertable_tablespace' \g
+--------------------------------------+------------+
| table_name                           | space_type |
+--------------------------------------+------------+
| testdb/test_file_pertable_tablespace | General    |
+--------------------------------------+------------+
1 row in set (0.00 sec)mysql>

例:修改表從系統(tǒng)表空間到通用表空間

mysql>  select->       name as 'table_name',->       space_type->   from->       information_schema.innodb_tables->   where->       name ='testdb/test_file_pertable' \g
+---------------------------+------------+
| table_name                | space_type |
+---------------------------+------------+
| testdb/test_file_pertable | System     |
+---------------------------+------------+
1 row in set (0.01 sec)mysql> alter table test_file_pertable tablespace=test_tbs1;
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0mysql> select->      name as 'table_name',->      space_type->  from->      information_schema.innodb_tables->  where->      name ='testdb/test_file_pertable' \g
+---------------------------+------------+
| table_name                | space_type |
+---------------------------+------------+
| testdb/test_file_pertable | General    |
+---------------------------+------------+
1 row in set (0.00 sec)mysql>
例2-3:修改表從通用表空間或系統(tǒng)表空間到獨(dú)立表空間

可以通過(guò)如下命令修改表從通用表空間或系統(tǒng)表空間到獨(dú)立表空間。

ALTER TABLE tbl_name TABLESPACE [=] innodb_file_per_table;

例:修改表從通用表空間到獨(dú)立表空間

mysql> select->      name as 'table_name',->      space_type->  from->      information_schema.innodb_tables->  where->      name ='testdb/test_file_pertable' \g
+---------------------------+------------+
| table_name                | space_type |
+---------------------------+------------+
| testdb/test_file_pertable | General    |
+---------------------------+------------+
1 row in set (0.00 sec)mysql>  alter table test_file_pertable tablespace=innodb_file_per_table;
Query OK, 0 rows affected (0.04 sec)
Records: 0  Duplicates: 0  Warnings: 0mysql>  select->       name as 'table_name',->       space_type->   from->       information_schema.innodb_tables->   where->       name ='testdb/test_file_pertable' \g
+---------------------------+------------+
| table_name                | space_type |
+---------------------------+------------+
| testdb/test_file_pertable | Single     |
+---------------------------+------------+
1 row in set (0.01 sec)mysql>
例2-4:修改表從通用表空間或獨(dú)立表空間到系統(tǒng)表空間

可以通過(guò)如下命令修改表從通用表空間或獨(dú)立表空間到系統(tǒng)表空間。

ALTER TABLE tbl_name TABLESPACE [=] innodb_system;

例:修改表從獨(dú)立表空間到系統(tǒng)表空間

mysql> select->      name as 'table_name',->      space_type->  from->      information_schema.innodb_tables->  where->      name ='testdb/test_file_pertable' \g
+---------------------------+------------+
| table_name                | space_type |
+---------------------------+------------+
| testdb/test_file_pertable | Single     |
+---------------------------+------------+
1 row in set (0.00 sec)mysql>
mysql> alter table test_file_pertable tablespace=innodb_system;
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0mysql> select->      name as 'table_name',->      space_type->  from->      information_schema.innodb_tables->  where->      name ='testdb/test_file_pertable' \g
+---------------------------+------------+
| table_name                | space_type |
+---------------------------+------------+
| testdb/test_file_pertable | System     |
+---------------------------+------------+
1 row in set (0.00 sec)

參考

15.6.3.3 General Tablespaces
https://dev.mysql.com/doc/refman/8.0/en/general-tablespaces.html

13.1.21 CREATE TABLESPACE Statement
https://dev.mysql.com/doc/refman/8.0/en/create-tablespace.html

Chapter 2 Server Error Message Reference
https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html
Error number: 3121; Symbol: ER_WRONG_FILE_NAME; SQLSTATE: HY000
Message: Incorrect File Name ‘%s’.

http://www.risenshineclean.com/news/47962.html

相關(guān)文章:

  • 微營(yíng)銷是什么seo如何快速排名百度首頁(yè)
  • 網(wǎng)站建設(shè)用的服務(wù)器統(tǒng)計(jì)網(wǎng)站流量的網(wǎng)站
  • 重慶網(wǎng)站建設(shè)近重慶零臻科技seo網(wǎng)站優(yōu)化報(bào)價(jià)
  • web網(wǎng)站開(kāi)發(fā)里怎么切換界面域名seo站長(zhǎng)工具
  • 如何快速做網(wǎng)站排名網(wǎng)絡(luò)營(yíng)銷優(yōu)化培訓(xùn)
  • 哪些網(wǎng)站可以做詳情頁(yè)企業(yè)關(guān)鍵詞大全
  • 印刷網(wǎng)站模板下載湛江百度seo公司
  • wordpress模板自媒體seo推廣軟件排行榜前十名
  • 網(wǎng)站認(rèn)證打的錢怎么做分錄重慶百度推廣seo
  • 合同 制作 網(wǎng)站網(wǎng)絡(luò)營(yíng)銷好找工作嗎
  • 文章博客媒體網(wǎng)站模板小學(xué)生收集的新聞10條
  • wordpress 網(wǎng)站主題太原seo團(tuán)隊(duì)
  • 加盟網(wǎng)站開(kāi)發(fā)費(fèi)用谷歌seo培訓(xùn)
  • 登陸國(guó)外的網(wǎng)站要這么做百度推廣投訴人工電話
  • 自助式建網(wǎng)站游戲推廣員上班靠譜嗎
  • 廣西建設(shè)職業(yè)學(xué)院官網(wǎng)網(wǎng)站網(wǎng)絡(luò)營(yíng)銷策劃案怎么寫(xiě)
  • 第三方微信網(wǎng)站建設(shè)全國(guó)人大常委會(huì)
  • 馬尾網(wǎng)站建設(shè)百度推廣沒(méi)有效果怎么辦
  • 無(wú)線網(wǎng)絡(luò)管理系統(tǒng)長(zhǎng)沙seo網(wǎng)絡(luò)推廣
  • 免費(fèi)網(wǎng)站建設(shè)那個(gè)好鏈接檢測(cè)工具
  • 軟件推薦網(wǎng)站溫州seo排名公司
  • 株洲網(wǎng)站建設(shè)什么是網(wǎng)站seo
  • 高端網(wǎng)站建設(shè)注意網(wǎng)絡(luò)營(yíng)銷案例ppt
  • 深圳市seo網(wǎng)站設(shè)計(jì)多少錢國(guó)外服務(wù)器免費(fèi)ip地址
  • adobe網(wǎng)站制作合肥正規(guī)的seo公司
  • 商業(yè)網(wǎng)站建設(shè)規(guī)劃書(shū)網(wǎng)絡(luò)營(yíng)銷工具介紹
  • 電商網(wǎng)站用php做的嗎網(wǎng)絡(luò)營(yíng)銷的表現(xiàn)形式有哪些
  • 網(wǎng)站虛擬主機(jī)購(gòu)買教程seo公司網(wǎng)站推廣
  • 建設(shè)局網(wǎng)站施工合同范本上海網(wǎng)站建設(shè)哪家好
  • 企業(yè)網(wǎng)站建設(shè)開(kāi)發(fā)費(fèi)用seo基礎(chǔ)知識(shí)培訓(xùn)