MySQL的⽬录结构及⽂件说明|CSDN创作打卡
⽬录
前⾔
本⽂主要介绍下MySQL的⽬录结构及⽂件说明
测试环境
虚拟机环境:VirtualBox 6.0.24
操作系统:Oracle Linux Server relea 6.5 x86_64
MySQL版本:5.7.33
MySQL的⽬录结构及⽂件说明
不同安装包,⽬录结构会有所不同。本环境为⼆进制安装包。
如下所⽰:
#查看mysql是否启动
[root@rac02 ~]# ps -ef|grep mysql
root 2458024537010:21 pts/0 00:00:00 grep mysql
#未启动,则⼿动启动mysql
[root@rac02 ~]# rvice mysql start
Starting MySQL. [ OK ]
#再次校验mysql进程是否存在
[root@rac02 ~]# ps -ef|grep mysql
root 246591010:21 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/mysql-files --pid-file=/usr/local/mysql/mysql-f iles/rac02.pid
mysql 2563324659410:21 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --badir=/usr/local/mysql --datadir=/usr/local/mysql/mysql-files --plugin-dir=/us r/local/mysql/lib/plugin --ur=mysql --log-error=/
usr/local/mysql/mysql-files/error.log --open-files-limit=65535 --pid-file=/usr/local/mysql/mysql-files/rac02.pid --socket=/usr/local/mysql/mysql-files/mysql.sock --port=3306dear basketball
root 2578124537010:21 pts/0 00:00:00 grep mysql
#进⼊mysql根⽬录
[root@rac02 ~]# cd /usr/local/mysql/
#mysql⽬录结构
[root@rac02 mysql]# ls
bin docs include lib LICENSE man mysql-files README share support-files
[root@rac02 mysql]# ls -al
total 292
drwxr-xr-x 10 root root 4096 Jan 2615:41 .
drwxr-xr-x. 13 root root 4096 Jan 2615:38 ..
drwxr-xr-x 2 root root 4096 Jan 2615:37 bin
drwxr-xr-x 2 root root 4096 Jan 2615:37 docs
drwxr-xr-x 3 root root 4096 Jan 2615:37 include
drwxr-xr-x 5 root root 4096 Jan 2615:37 lib
-rw-r--r-- 1716131415250129 Dec 102020 LICENSE
drwxr-xr-x 4 root root 4096 Jan 2615:37 man
drwxr-x--- 6 mysql mysql 4096 Jan 2710:21 mysql-files
-rw-r--r-- 1716131415566 Dec 102020 README
drwxr-xr-x 28 root root 4096 Jan 2615:37 share
drwxr-xr-x 2 root root 4096 Jan 2615:37 support-files
⽬录解释如下:
bin: 包含客户端程序和mysqld等⼆进制可执⾏⽂件。
docs: 包含ChangeLog、INFO_BIN、INFO_SRC等信息。
include: 包含(头) ⽂件的⽬录。
lib: 可动态加载的so库⽂件⽬录。
man: 包含man1、 man8。
share: 包含MySQL初始化的⼀些SQL脚本以及错误代码、 本地化语⾔⽂件等。
support-files: 包含单实例启停脚本mysql.rver和多实例启停脚本 mysqld_multi.rver等。mysql-files:⾃定义的数据⽂件⽬录。
#实际查看情况如下:
[root@rac02 mysql]# cd bin
[root@rac02 bin]# ls
脱缰之马innochecksum mysqladmin mysqld_multi mysqlpump mysqlxtest
lz4_decompress mysqlbinlog mysqld_safe mysql_cure_installation perror myisamchk mysqlcheck mysqldump mysqlshow replace
myisam_ftdump mysql_client_test_embedded mysqldumpslow mysqlslap resolveip myisamlog mysql_config mysql_embedded mysql_ssl_rsa_tup resolve_stack_dump myisampack mysql_config_editor mysqlimport mysqltest_embedded zlib_decompress my_print_defaults mysqld mysql_install_db mysql_tzinfo_to_sql
mysql mysqld-debug mysql_plugin mysql_upgrade
[root@rac02 bin]# cd ../docs
[root@rac02 docs]# ls
ChangeLog INFO_BIN INFO_SRC
[root@rac02 docs]# cd ../include/
[root@rac02 include]# ls
big_endian.h my_byteorder.h mysql_com_rver.h my_thread.h sslopt-ca.h
binary_log_types.h my_command.h mysqld_ername.h my_thread_local.h sslopt-longopts.h byte_order_generic.h my_compiler.h mysqld_error.h my_xml.h sslopt-vars.h
flopbyte_order_generic_x86.h my_config.h mysql_embed.h plugin_audit.h thr_cond.h decimal.h my_dbug.h mysql.h plugin_ftparr.h thr_mutex.h
errmsg.h my_dir.h mysql_time.h plugin_group_replication.h thr_rwlock.h keycache.h my_getopt.h mysql_version.h plugin.h typelib.h
little_endian.h my_global.h mysqlx_ername.h plugin_keyring.h
m_ctype.h my_list.h mysqlx_error.h plugin_validate_password.h
m_string.h mysql mysqlx_version.h sql_common.h
my_alloc.h mysql_com.h my_sys.h sql_state.h
[root@rac02 include]# cd ../lib
[root@rac02 lib]# ls
libmysqlclient.a libmysqlclient.so.20 libmysqld.a libmysqlrvices.a pkgconfig
libmysqlclient.so libmysqlclient.so.20.3.20 libmysqld-debug.a mecab plugin
[root@rac02 lib]# cd ../man
[root@rac02 man]# ls
man1 man8
[root@rac02 man]# cd man1
[root@rac02 man1]# ls
comp_err.1 my_print_defaults.1 mysqld_multi.1 mysql_plugin.1 mysql_tzinfo_to_sql.1 innochecksum.1 mysql.1 mysqld_safe.1 mysqlpump.1 mysql_upgrade.1
lz4_decompress.1 mysqladmin.1 mysqldump.1 mysql_cure_installation.1 perror.1 myis
amchk.1 mysqlbinlog.1 mysqldumpslow.1 mysql.rver.1 replace.1
myisam_ftdump.1 mysqlcheck.1 mysqlimport.1 mysqlshow.1 resolveip.1 myisamlog.1 mysql_config.1 mysql_install_db.1 mysqlslap.1 resolve_stack_dump.1 myisampack.1 mysql_config_editor.1 mysqlman.1 mysql_ssl_rsa_tup.1 zlib_decompress.1 [root@rac02 man1]# cd ../../share/
[root@rac02 share]# ls
aclocal fill_help_tables.sql mysql_curity_commands.sql russian
bulgarian french mysql_sys_schema.sql rbian
charts german mysql_system_tables_data.sql slovak
czech greek mysql_system_tables.sql spanish
danish hungarian mysql_test_data_timezone.sql swedish
< innodb_memcached_config.sql norwegian ukrainian
dutch install_rewriter.sql norwegian-ny uninstall_rewriter.sql
english italian polish
< japane portugue
estonian korean romanian
[root@rac02 share]# cd ../support-files/
[root@rac02 support-files]# ls
magic mysqld_multi.rver mysql-log-rotate mysql.rver
英语短文阅读
[root@rac02 support-files]#
数据⽂件⽬录如下所⽰
[root@rac02 mysql-files]# ls -al
total 639228
drwxr-x--- 6 mysql mysql 4096 Jan 2710:21 .
drwxr-xr-x 10 root root 4096 Jan 2615:41 ..
-rw-r----- 1 mysql mysql 56 Jan 2616:06 autof
-rw------- 1 mysql mysql 1676 Jan 2616:06 ca-key.pem
-rw-r--r-- 1 mysql mysql 1112 Jan 2616:06 ca.pem
-rw-r--r-- 1 mysql mysql 1112 Jan 2616:06 client-cert.pem
没离开过原唱是谁-rw------- 1 mysql mysql 1680 Jan 2616:06 client-key.pem
-rw-r----- 1 mysql mysql 78280 Jan 2710:21 error.log
-rw-r----- 1 mysql mysql 347 Jan 27 06:29 ib_buffer_pool
-rw-r----- 1 mysql mysql 12582912 Jan 2710:21 ibdata1
-rw-r----- 1 mysql mysql 209715200 Jan 2710:21 ib_logfile0
-
rw-r----- 1 mysql mysql 209715200 Jan 2620:15 ib_logfile1
-rw-r----- 1 mysql mysql 209715200 Jan 2620:15 ib_logfile2
-rw-r----- 1 mysql mysql 12582912 Jan 2710:21 ibtmp1
-rw-r----- 1 mysql mysql 6101 Jan 2710:40 innodb_status.25633 drwxr-x--- 2 mysql mysql 4096 Jan 2616:06 mysql
-rw-r----- 1 mysql mysql 177 Jan 2620:26 mysql_binlog.000001 -rw-r----- 1 mysql mysql 177 Jan 2620:28 mysql_binlog.000002 -rw-r----- 1 mysql mysql 177 Jan 2620:29 mysql_binlog.000003 -rw-r----- 1 mysql mysql 177 Jan 2620:30 mysql_binlog.000004 -rw-r----- 1 mysql mysql 177 Jan 2620:34 mysql_binlog.000005 -rw-r----- 1 mysql mysql 336 Jan 2621:01 mysql_binlog.000006 -rw-r----- 1 mysql mysql 217 Jan 2621:08 mysql_binlog.000007 -rw-r----- 1 mysql mysql 217 Jan 2621:14 mysql_binlog.000008 -rw-r----- 1 mysql mysql 217 Jan 2621:15 mysql_binlog.000009 -rw-r----- 1 mysql mysql 217 Jan 2621:16 mysql_binlog.000010 -rw-r----- 1 mysql mysql 217 Jan 27 03:24 mysql_binlog.000011 -rw-r----- 1 mysql mysql 217 Jan 27 03:28 mysql_binlog.000012 -rw-r----- 1 mysql mysql 217 Jan 27 03:28 mysql_binlog.000013 -rw-r----- 1 mysql mysql 861 Jan 27 05:22 mysql_binlog.000014 -rw-r----- 1 mysql mysql 217 Jan
27 06:29 mysql_binlog.000015 -rw-r----- 1 mysql mysql 194 Jan 2710:21 mysql_binlog.000016 -rw-r----- 1 mysql mysql 784 Jan 2710:21 mysql_binlog.index srwxrwxrwx 1 mysql mysql 0 Jan 2710:21 mysql.sock
-rw------- 1 mysql mysql 6 Jan 2710:21 mysql.sock.lock
drwxr-x--- 2 mysql mysql 4096 Jan 2616:06 performance_schema -rw------- 1 mysql mysql 1680 Jan 2616:06 private_key.pem
-rw-r--r-- 1 mysql mysql 452 Jan 2616:06 public_key.pem
-rw-r----- 1 mysql mysql 6 Jan 2710:21 rac02.pid
-rw-r--r-- 1 mysql mysql 1112 Jan 2616:06 rver-cert.pem
-rw------- 1 mysql mysql 1680 Jan 2616:06 rver-key.pem
-rw-r----- 1 mysql mysql 3846 Jan 2710:21 slow.log
drwxr-x--- 2 mysql mysql 12288 Jan 2616:06 sys
drwxr-x--- 2 mysql mysql 4096 Jan 2620:45 test
[root@rac02 mysql-files]# tree
.
├── autof
├── ca-key.pem
├── ca.pem
├── client-cert.pem
├── client-key.pem
├── error.log
├── ib_buffer_pool
├── ibdata1
├── ib_logfile0
├── ib_logfile1
├── ib_logfile2
├── ibtmp1
├── innodb_status.25633
├── mysql
│├── columns_priv.frm
│├── columns_priv.MYD
│├── columns_priv.MYI
│├── db.frm
│├── db.MYD
│├── db.MYI
│├── db.opt
│├── engine_cost.frm
│├── engine_cost.ibdnow
│├── event.frm
│├── event.MYD
│├── event.MYI
│├── func.frm
│├── func.MYD
│├── func.MYI
be interested in│├── general_log.CSM
│├── general_log.CSV
│├── general_log.frm
│├── gtid_executed.frm
│├── gtid_executed.ibd
│├── help_category.frm
│├── help_category.ibd
│├── help_keyword.frm
│├── help_keyword.ibd
│├── help_relation.frm
│├── help_relation.ibd
│├── help_topic.frm
│├── help_topic.ibd
│├── innodb_index_stats.frm
│├── innodb_index_stats.ibd
│├── innodb_table_stats.frm
│├── innodb_table_stats.ibd
│├── ndb_binlog_index.frm
│├── ndb_binlog_index.MYD
│├── ndb_binlog_index.MYI
│├── plugin.frm
│├── plugin.ibd
│├── proc.frm
│├── proc.MYD
│├── proc.MYI
│├── procs_priv.frm
│├── procs_priv.MYD
│├── procs_priv.MYI
│├── proxies_priv.frm
│├── proxies_priv.MYD
│├── proxies_priv.MYI
│├── rver_cost.frm
│├── rver_cost.ibd
│├── rvers.frm
so far so good
│├── rvers.ibd
│├── slave_master_info.frm
│├── slave_master_info.ibd
│├── slave_relay_log_info.frm
│├── slave_relay_log_info.ibd
│├── slave_worker_info.frm
│├── slave_worker_info.ibd
│├── slow_log.CSM
│├── slow_log.CSV
│├── slow_log.frm
│├── tables_priv.frm
孙权劝学翻译
│├── tables_priv.MYD
│├── tables_priv.MYIlily思维英语怎么样
│├── time_zone.frm
│├── time_zone.ibd
│├── time_zone_leap_cond.frm │├── time_zone_leap_cond.ibd │├── time_zone_name.frm
│├── time_zone_name.ibd
│├── time_zone_transition.frm