Mysql入门innodb存储引擎修改表共享空间为独立空间
《Mysql入门innodb存储引擎修改表共享空间为独立空间》要点: 1,查看一下是共享表空间,还是独立表空间 mysql> show variables like '%per_table%'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | innodb_file_per_table | OFF | +-----------------------+-------+ 1 row in set (0.00 sec) 如果是OFF,肯定不是独立表空间.如果是ON的话,也不一定是独立表空间.最直接的办法就是查看硬盘上的文件,独立表空间,每个表都对应了一个空间. [/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是一个数据库名,里面的都是innodb的.像这种情况就是共享表空间.MYSQL教程 2,停掉mysql /etc/init.d/mysqld stop 3,修改my.cnf的配置文件 innodb-file-per-table=1 4,备份使用innodb引擎的数据库 mysqldump -u tg -p tg >/home/6fan/tg.sql; 5,删除使用innodb的数据库,以及日志文件 cd /var/lib/mysql //数据库文件位置 rm -f ib* //删除日志和空间 rm -rf tg //删除使用innodb引擎的数据库文件夹 如果不删除使用innodb的数据库文件夹,启动不了innodb引擎,我查看了一下错误日志.如下MYSQL教程 代码如下: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 /etc/init.d/mysqld start 7,导入数据库 mysql -u root -p < /home/6fan/tg.sql 8,在查看一下,是转换好了MYSQL教程 代码如下:mysql> show variables like '%per_table%'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | innodb_file_per_table | ON | +-----------------------+-------+ 1 row in set (0.00 sec) //查看数据库目录下的文件 [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 从这里可以看出,每一张表都对应有一个.ibd的文件,根共享表空间是纷歧样的.到这儿就完全配置好了. 《Mysql入门innodb存储引擎修改表共享空间为独立空间》是否对您有启发,欢迎查看更多与《Mysql入门innodb存储引擎修改表共享空间为独立空间》相关教程,学精学透。编程之家PHP学院为您提供精彩教程。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- WAMP服务器将MySQL切换到MariaDB
- MYSQL教程MySQL 数据库优化的具体方法说明
- 如何使用Python将API响应存储在MySQL数据库中?
- Mysql入门MySQL:reading initial communication packet问题
- mysql – 在查询中生成“假”记录
- Mysql学习Linux下指定mysql数据库数据配置主主同步的实例
- MYSQL数据库linux系统下实现mysql热备份详细步骤(mysql主从
- Mysql必读MySql安装启动两种方法教程详解
- MySql UPDATE优化?
- MYSQL数据库macOS Sierra安装Apache2.4+PHP7.0+MySQL5.7.16