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

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

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

2020-01-18 23:25:36
字體:
供稿:網(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ú)立表空間,每個表都對應(yīng)了一個空間。
[/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是一個數(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ù)庫文件夾,啟動不了innodb引擎,我查看了一下錯誤日志。如下

復(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,啟動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

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

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 民勤县| 二连浩特市| 西吉县| 阳城县| 通山县| 崇阳县| 高陵县| 即墨市| 那坡县| 杂多县| 湖州市| 大同市| 牙克石市| 阳江市| 荣成市| 读书| 吉隆县| 佛冈县| 苍梧县| 明水县| 陆丰市| 如皋市| 垣曲县| 木里| 锡林郭勒盟| 东乡族自治县| 上杭县| 蓬莱市| 东台市| 安塞县| 若尔盖县| 乌兰察布市| 兴隆县| 乌拉特前旗| 孝昌县| 和硕县| 曲沃县| 新河县| 张家港市| 连平县| 元阳县|