1.插入数据但不提交。
mysql> start transaction;
Query OK, 0 rows affected (0.00 sec)
mysql> insert into test6 values(4,'xsq');
Query OK, 1 row affected (0.00 sec)
2.[root@mysql1 mysql3306]# pidof mysqld
6655
3.删除文件。
[root@mysql1 mysql3306]# rm -rf ibdata1 ib_logfile0 ib_logfile1 ibtmp1
[root@mysql1 mysql3306]#
4.查看进程。
yum -y install net-tools
netstat -ntlp|grep mysqld |grep 6655
5.查看句柄。
[root@mysql1 mysql3306]# ll /proc/6655/fd |grep delete
lrwx------. 1 root root 64 Feb 18 18:11 10 -> /mysql/mysql3306/ibdata1 (deleted)
lrwx------. 1 root root 64 Feb 18 18:11 11 -> /mysql/mysql3306/ibtmp1 (deleted)
lrwx------. 1 root root 64 Feb 18 18:11 12 -> /tmp/ibC3BHNg (deleted)
lrwx------. 1 root root 64 Feb 18 18:11 4 -> /mysql/mysql3306/ib_logfile0 (deleted)
lrwx------. 1 root root 64 Feb 18 18:11 5 -> /tmp/ibZtLFWn (deleted)
lrwx------. 1 root root 64 Feb 18 18:11 6 -> /tmp/ibIalAsm (deleted)
lrwx------. 1 root root 64 Feb 18 18:11 7 -> /tmp/ibNc7uYk (deleted)
lrwx------. 1 root root 64 Feb 18 18:11 8 -> /tmp/ibHGNj7h (deleted)
lrwx------. 1 root root 64 Feb 18 18:11 9 -> /mysql/mysql3306/ib_logfile1 (deleted)
10,11,9,4
cd ll /proc/6655/fd
[root@mysql1 fd]# cp 10 /mysql/mysql3306/ibdata1
[root@mysql1 fd]# cp 11 /mysql/mysql3306/ibtmp1
[root@mysql1 fd]# cp 4 /mysql/mysql3306/ib_logfile0
[root@mysql1 fd]# cp 9 /mysql/mysql3306/ib_logfile1
chown -R mysql:mysql /mysql/mysql3306/*
*/
systemctl stop mysql
systemctl start mysql
[root@mysql1 mysql]# mysql -uroot -prootroot
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| jydb |
| mysql |
| performance_schema |
| sys |
| test |
| test2 |
+--------------------+
7 rows in set (0.00 sec)
mysql> select * from test6;
+----+------+
| id | name |
+----+------+
| 1 | xsq |
| 2 | xsq |
| 3 | xsq |
发现还是原来的三条数据。