Files location for the MySQL databases

Files location for the MySQL databases

Check with command from MySQL workbench or command window:

From MySQL Command prompt:
mysql> SELECT @@datadir
C:\ProgramData\MySQL\MySQL Server 8.0\Data\

On Windows Platform
Check the my.ini configuration file.

1) Go to the location of my.ini, which store in the MySQL installation folder.

Example C:\ProgramData\MySQL\MySQL Server 8.0\my.ini

2) Open the “my.ini” with notepad

# Path to installation directory. All paths are usually resolved relative to this.
# basedir="C:/Program Files/MySQL/MySQL Server 8.0/"

# Path to the database root
datadir=C:/ProgramData/MySQL/MySQL Server 8.0/Data

Note: datadir is the pointer of the location where datafiles are stored.

On Linux Platform
Check the my.cnf configuration file

1) Go to the my.cnf location with help of the find / -name my.cnf command as shown:

root@host1:~$ find / -name my.cnf
find: /home/lost+found: Permission denied
find: /lost+found: Permission denied
/etc/mysql/my.cnf

2) Open the my.cnf file.

yongmo@myserver:~$ cat /etc/mysql/my.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking

Note: Datadir is the pointer location where data files stored.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.