误删除world库里的city.frm文件后,发现city表没了
实例一:
1误删除world库里的city.frm文件后,发现city表没了
[root@instance-r5y0pf5d ~]# cd /data/mysql/data/world
[root@instance-r5y0pf5d /data/mysql/data/world]# ls
city.frm city.ibd country.ibd db.opt
[root@instance-r5y0pf5d /data/mysql/data/world]# rm -rf city.frm
[root@instance-r5y0pf5d /data/mysql/data/world]# mysql -uroot -p123456
mysql> use world;
Database changed
mysql> show tables;
Empty set (0.00 sec)
2恢复city.frm文件至world文件夹内,并增加mysql用户对该文件的权限
[root@instance-r5y0pf5d ~/HuiShouSite]# cp 20210202_10_59_11_city.frm /data/mysql/data/world/city.frm
[root@instance-r5y0pf5d ~/HuiShouSite]# ls /data/mysql/data/world/
city.frm city.ibd country.ibd db.opt
[root@instance-r5y0pf5d ~/HuiShouSite]# chown -R mysql.mysql /data/mysql/data/world/*
3登陆数据库验证
mysql> use world;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+-----------------+
| Tables_in_world |
+-----------------+
| city |
+-----------------+
1 row in set (0.00 sec)
mysql>

浙公网安备 33010602011771号