linux-MySQL的数据目录

总结:

  1. window中的my.ini == linux/etc/my.cnf
  2. window中的D:\soft\mysql-5.7.35-winx64\data == linux/var/lib/mysql

1.查找与mysql有关的目录

find / -name mysql

[root@VM-4-6-centos etc]# find / -name mysql
/opt/mysql
/etc/selinux/targeted/tmp/modules/100/mysql
/etc/selinux/targeted/active/modules/100/mysql
/etc/logrotate.d/mysql
/home/dhl/mysql
/home/dhl/mysql/data/mysql
/usr/local/mysql
/usr/share/mysql
/usr/bin/mysql
/usr/lib64/mysql
/var/lib/docker/volumes/a6f2dfdd46098a46ce629eddcd8104bcbd5488b53348ecf83bf5d11983c7b51b/_data/mysql
/var/lib/docker/volumes/50dc751ceed1bccb7aa43573b4e286f43ca138b57a51f875330e0cad5aff7cc1/_data/mysql
/var/lib/mysql
/var/lib/mysql/mysql

2. mysql配置文件

window中的my.ini == linux/etc/my.cnf
window
linux-MySQL的数据目录_第1张图片
linux
linux-MySQL的数据目录_第2张图片

3. mysql的数据库文件:

linux: /var/lib/mysql
window: D:\soft\mysql-5.7.35-winx64\data

[root@VM-4-6-centos etc]# cd /var/lib/mysql
[root@VM-4-6-centos mysql]# ls
auto.cnf    client-cert.pem  ibdata1      ibtmp1      mysql.sock.lock     private_key.pem  server-key.pem
ca-key.pem  client-key.pem   ib_logfile0  mysql       mytest              public_key.pem   sys
ca.pem      ib_buffer_pool   ib_logfile1  mysql.sock  performance_schema  server-cert.pem
[root@VM-4-6-centos mysql]# cd mytest
[root@VM-4-6-centos mytest]# ll
total 456
-rw-r----- 1 mysql mysql    44 Aug  1 13:50 before_insert.TRN
-rw-r----- 1 mysql mysql  8680 Jul 31 19:07 book1.frm
-rw-r----- 1 mysql mysql 98304 Aug  1 14:46 book1.ibd
-rw-r----- 1 mysql mysql   494 Aug  1 13:59 book1.TRG
-rw-r----- 1 mysql mysql  8680 Aug  1 16:24 book2.frm
-rw-r----- 1 mysql mysql 98304 Aug  1 17:18 book2.ibd
-rw-r----- 1 mysql mysql    37 Aug  1 13:59 book_check_num.TRN
-rw-r----- 1 mysql mysql    67 Jul 31 18:07 db.opt
-rw-r----- 1 mysql mysql  8590 Aug  1 13:49 test_trigger.frm
-rw-r----- 1 mysql mysql 98304 Aug  1 13:51 test_trigger.ibd
-rw-r----- 1 mysql mysql  8588 Aug  1 13:49 test_trigger_log.frm
-rw-r----- 1 mysql mysql 98304 Aug  1 13:51 test_trigger_log.ibd
-rw-r----- 1 mysql mysql   362 Aug  1 13:50 test_trigger.TRG
-rw-r----- 1 mysql mysql   513 Jul 31 17:58 view_test.frm
[root@VM-4-6-centos mytest]# 

将ibd文件解析为txt文件

  • 需要mysql8 我的是mysql5
[root@VM-4-6-centos mysql]# cd mytest
[root@VM-4-6-centos mytest]# ll
total 456
-rw-r----- 1 mysql mysql    44 Aug  1 13:50 before_insert.TRN
-rw-r----- 1 mysql mysql  8680 Jul 31 19:07 book1.frm
-rw-r----- 1 mysql mysql 98304 Aug  1 14:46 book1.ibd
-rw-r----- 1 mysql mysql   494 Aug  1 13:59 book1.TRG
-rw-r----- 1 mysql mysql  8680 Aug  1 16:24 book2.frm
-rw-r----- 1 mysql mysql 98304 Aug  1 17:18 book2.ibd
-rw-r----- 1 mysql mysql    37 Aug  1 13:59 book_check_num.TRN
-rw-r----- 1 mysql mysql    67 Jul 31 18:07 db.opt
-rw-r----- 1 mysql mysql  8590 Aug  1 13:49 test_trigger.frm
-rw-r----- 1 mysql mysql 98304 Aug  1 13:51 test_trigger.ibd
-rw-r----- 1 mysql mysql  8588 Aug  1 13:49 test_trigger_log.frm
-rw-r----- 1 mysql mysql 98304 Aug  1 13:51 test_trigger_log.ibd
-rw-r----- 1 mysql mysql   362 Aug  1 13:50 test_trigger.TRG
-rw-r----- 1 mysql mysql   513 Jul 31 17:58 view_test.frm
[root@VM-4-6-centos mytest]# ibd2sdi --dump-file=book1.txt book1.ibd
-bash: ibd2sdi: command not found

注意点:

  1. mysql 5.7 以前 数据存放在 ibdfrm两个文件中,5.7以后frm合并到ibd中,只有一个ibd

你可能感兴趣的:(mysql,linux操作系统,linux,mysql,数据库)