MySQL Tutorials - Herong's Tutorial Examples - v4.46, by Herong Yang
MySQL Server File Locations on CentOS
This section provides a tutorial example on how to find and view MySQL Server file locations for MySQL 8.0 server on CentOS 8 systems.
In order to properly maintain MySQL server, you need to know how and where MySQL server stores its files. As an example, here are the locations of MySQL server files on my CentOS 8 computer:
1. MySQL command program files are stored in 2 directories:
herong$ ls -l /usr/sbin grep mysql lrwxrwxrwx. 1 root root 19 Oct 8 09:34 mysqld -> /usr/libexec/mysqld herong$ ls -l /usr/bin grep mysql -rwxr-xr-x. 1 root root 7703224 Oct 8 09:37 mysql -rwxr-xr-x. 1 root root 7474568 Oct 8 09:37 mysqladmin -rwxr-xr-x. 1 root root 8198496 Oct 8 09:37 mysqlbinlog -rwxr-xr-x. 1 root root 7495776 Oct 8 09:37 mysqlcheck -rwxr-xr-x. 1 root root 674528 Oct 8 09:37 mysql_config_editor -rwxr-xr-x. 1 root root 4392 Oct 8 09:24 mysqld_pre_systemd -rwxr-xr-x. 1 root root 7587512 Oct 8 09:37 mysqldump -rwxr-xr-x. 1 root root 7690 Oct 8 09:24 mysqldumpslow -rwxr-xr-x. 1 root root 7473216 Oct 8 09:37 mysqlimport -rwxr-xr-x. 1 root root 8380208 Oct 8 09:37 mysqlpump -rwxr-xr-x. 1 root root 7458664 Oct 8 09:37 mysql_secure_installation -rwxr-xr-x. 1 root root 7467968 Oct 8 09:37 mysqlshow -rwxr-xr-x. 1 root root 7497168 Oct 8 09:37 mysqlslap -rwxr-xr-x. 1 root root 733424 Oct 8 09:37 mysql_ssl_rsa_setup -rwxr-xr-x. 1 root root 541152 Oct 8 09:37 mysql_tzinfo_to_sql -rwxr-xr-x. 1 root root 7656336 Oct 8 09:37 mysql_upgrade
2. MySQL server data and log files are located at /var/lib/mysql. Each database is stored a separate sub-directory:
herong$ ls -l /var/lib/mysql total 188988 -rw-r-----. 1 mysql mysql 56 Mar 26 22:02 auto.cnf -rw-r-----. 1 mysql mysql 18315580 Mar 27 05:49 binlog.000001 -rw-r-----. 1 mysql mysql 178 Mar 27 06:13 binlog.000002 -rw-r-----. 1 mysql mysql 9995 Mar 28 08:14 binlog.000003 -rw-r-----. 1 mysql mysql 2785 Mar 28 08:33 binlog.000004 -rw-r-----. 1 mysql mysql 64 Mar 28 08:15 binlog.index -rw-------. 1 mysql mysql 1680 Mar 26 22:02 ca-key.pem -rw-r--r--. 1 mysql mysql 1112 Mar 26 22:02 ca.pem -rw-r--r--. 1 mysql mysql 1112 Mar 26 22:02 client-cert.pem -rw-------. 1 mysql mysql 1676 Mar 26 22:02 client-key.pem -rw-r-----. 1 mysql mysql 4188 Mar 28 08:14 ib_buffer_pool -rw-r-----. 1 mysql mysql 12582912 Mar 28 08:34 ibdata1 -rw-r-----. 1 mysql mysql 50331648 Mar 28 08:34 ib_logfile0 -rw-r-----. 1 mysql mysql 50331648 Mar 26 22:01 ib_logfile1 -rw-r-----. 1 mysql mysql 12582912 Mar 28 08:15 ibtmp1 drwxr-x---. 2 mysql mysql 187 Mar 28 08:15 '#innodb_temp' drwxr-x---. 2 mysql mysql 143 Mar 26 22:02 mysql -rw-r-----. 1 mysql mysql 24117248 Mar 28 08:33 mysql.ibd srwxrwxrwx. 1 mysql mysql 0 Mar 28 08:15 mysql.sock -rw-------. 1 mysql mysql 5 Mar 28 08:15 mysql.sock.lock -rw-r--r--. 1 mysql mysql 7 Mar 26 22:02 mysql_upgrade_info srwxrwxrwx. 1 mysql mysql 0 Mar 28 08:15 mysqlx.sock -rw-------. 1 mysql mysql 6 Mar 28 08:15 mysqlx.sock.lock drwxr-x---. 2 mysql mysql 8192 Mar 26 22:02 performance_schema -rw-------. 1 mysql mysql 1676 Mar 26 22:02 private_key.pem -rw-r--r--. 1 mysql mysql 452 Mar 26 22:02 public_key.pem -rw-r--r--. 1 mysql mysql 1112 Mar 26 22:02 server-cert.pem -rw-------. 1 mysql mysql 1680 Mar 26 22:02 server-key.pem drwxr-x---. 2 mysql mysql 28 Mar 26 22:02 sys drwxr-x---. 2 mysql mysql 181 Mar 27 02:00 test -rw-r-----. 1 mysql mysql 12582912 Mar 28 08:33 undo_001 -rw-r-----. 1 mysql mysql 12582912 Mar 28 08:32 undo_002
Table of Contents
MySQL Introduction and Installation
Introduction of MySQL Programs
Perl Programs and MySQL Servers
Java Programs and MySQL Servers
Character Strings and Bit Strings
Table Column Types for Different Types of Values
Using DDL to Create Tables and Indexes
Using DML to Insert, Update and Delete Records
Using SELECT to Query Database
Window Functions for Statistical Analysis
Use Index for Better Performance
Transaction Management and Isolation Levels
Defining and Calling Stored Procedures
Variables, Loops and Cursors Used in Stored Procedures
System, User-Defined and Stored Procedure Variables
Storage Engines in MySQL Server
InnoDB Storage Engine - Primary and Secondary Indexes
Performance Tuning and Optimization
►Installing MySQL Server on Linux
Install MySQL Database Server on CentOS
Manage MySQL Server 'mysqld' on CentOS
Set MySQL Server "root" Password on CentOS
►MySQL Server File Locations on CentOS
MySQL Server Data Backups on CentOS
MySQL Server Log Files on CentOS
"Multiple files found for the same tablespace ID" Error