国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

innodb存儲(chǔ)引擎修改表共享空間為獨(dú)立空間

2024-07-24 13:05:17
字體:
供稿:網(wǎng)友

1,查看一下是共享表空間,還是獨(dú)立表空間

復(fù)制代碼 代碼如下:


mysql> show variables like '%per_table%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| innodb_file_per_table | OFF |
+-----------------------+-------+
1 row in set (0.00 sec)


如果是OFF,肯定不是獨(dú)立表空間。如果是ON的話,也不一定是獨(dú)立表空間。最直接的方法就是查看硬盤上的文件,獨(dú)立表空間,每個(gè)表都對(duì)應(yīng)了一個(gè)空間。
[/code]
[root@localhost tg]# ll
總用量 64
-rw-rw----. 1 mysql mysql 65 12月 30 20:09 db.opt
-rw-rw----. 1 mysql mysql 8658 12月 30 23:17 gb.frm
-rw-rw----. 1 mysql mysql 8658 12月 30 23:19 qr.frm
-rw-rw----. 1 mysql mysql 8658 12月 30 23:19 qy.frm
-rw-rw----. 1 mysql mysql 8658 12月 30 23:19 tg.frm
-rw-rw----. 1 mysql mysql 8658 12月[/code]

tg是一個(gè)數(shù)據(jù)庫名,里面的都是innodb的。像這種情況就是共享表空間。

2,停掉mysql

復(fù)制代碼 代碼如下:


/etc/init.d/mysqld stop

3,修改my.cnf的配置文件

復(fù)制代碼 代碼如下:


innodb-file-per-table=1

4,備份使用innodb引擎的數(shù)據(jù)庫

復(fù)制代碼 代碼如下:


mysqldump -u tg -p tg >/home/6fan/tg.sql;

5,刪除使用innodb的數(shù)據(jù)庫,以及日志文件

復(fù)制代碼 代碼如下:


cd /var/lib/mysql //數(shù)據(jù)庫文件位置
rm -f ib* //刪除日志和空間
rm -rf tg //刪除使用innodb引擎的數(shù)據(jù)庫文件夾

如果不刪除使用innodb的數(shù)據(jù)庫文件夾,啟動(dòng)不了innodb引擎,我查看了一下錯(cuò)誤日志。如下

復(fù)制代碼 代碼如下:


111231 20:54:44 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 512 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200 300 400 500
111231 20:54:50 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 512 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Progress in MB: 100 200 300 400 500
InnoDB: Cannot initialize created log files because
InnoDB: data files are corrupt, or new data files were
InnoDB: created when the database was started previous
InnoDB: time but the database was not shut down
InnoDB: normally after that.
111231 20:54:55 [ERROR] Plugin 'InnoDB' init function returned error.
111231 20:54:55 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
111231 20:54:55 [Note] Event Scheduler: Loaded 0 events

6,啟動(dòng)mysql

復(fù)制代碼 代碼如下:


/etc/init.d/mysqld start

7,導(dǎo)入數(shù)據(jù)庫

復(fù)制代碼 代碼如下:


mysql -u root -p < /home/6fan/tg.sql

8,在查看一下,是轉(zhuǎn)換好了

復(fù)制代碼 代碼如下:


mysql> show variables like '%per_table%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| innodb_file_per_table | ON |
+-----------------------+-------+
1 row in set (0.00 sec)
//查看數(shù)據(jù)庫目錄下的文件
[root@localhost tg]# ll
總用量 544
-rw-rw----. 1 mysql mysql 65 12月 31 22:48 db.opt
-rw-rw----. 1 mysql mysql 8658 12月 31 22:49 gb.frm
-rw-rw----. 1 mysql mysql 98304 12月 31 22:49 gb.ibd
-rw-rw----. 1 mysql mysql 8658 12月 31 22:49 qr.frm
-rw-rw----. 1 mysql mysql 98304 12月 31 22:49 qr.ibd
-rw-rw----. 1 mysql mysql 8658 12月 31 22:49 qy.frm
-rw-rw----. 1 mysql mysql 98304 12月 31 22:49 qy.ibd
-rw-rw----. 1 mysql mysql 8658 12月 31 22:49 tg.frm
-rw-rw----. 1 mysql mysql 98304 12月 31 22:49 tg.ibd
-rw-rw----. 1 mysql mysql 8658 12月 31 22:49 xcy.frm
-rw-rw----. 1 mysql mysql 98304 12月 31 22:49 xcy.ibd


從這里可以看出,每一張表都對(duì)應(yīng)有一個(gè).ibd的文件,根共享表空間是不一樣的。到這兒就完全配置好了。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 明水县| 浠水县| 梨树县| 大石桥市| 河间市| 仁化县| 三门峡市| 南靖县| 临猗县| 香格里拉县| 邳州市| 清新县| 保山市| 芦山县| 开江县| 博乐市| 札达县| 仪陇县| 中宁县| 安平县| 莱州市| 西乌珠穆沁旗| 浑源县| 永仁县| 福州市| 石林| 会东县| 合肥市| 阿坝县| 巩留县| 巍山| 齐河县| 孝昌县| 邯郸市| 古田县| 永顺县| 界首市| 桃园县| 探索| 喜德县| 新丰县|