Where mysql in linux

Where does MySQL store its databases on Debian?

Our system crashed and we’re trying to recover our data. The disc is fine, but the OS is gone, so I’m trying to get at the actual MySQL database files. Does anybody know where to look for them in a Debian Linux server?

2 Answers 2

MySQL stores DB files in /var/lib/mysql by default, but you can override this in the configuration file, typically called /etc/my.cnf , although Debian calls it /etc/mysql/my.cnf .

In Debian default setup, you need to be root to view the contents of /var/lib/mysql, just to make it clear. As user, you’ll see an almost empty directory if you do: ls /var/lib/mysql

Check /opt/lampp/var/mysql/ also. It is the database directory for the XAMPP program.

It looks to me, based on searching for that path, like this path comes in with a package called Xampp.

You must log in to answer this question.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533

Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group.
This site is not affiliated with Linus Torvalds or The Open Group in any way.

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Читайте также:  Secure ports in linux

Источник

Where does mysql store data?

Where does mysql store data? I found out (by using mysql>SELECT @@datadir ) that it’s in var/lib/mysql — but that can’t be it. I have a quite big database (4 GB) called ‘bot’, but all the files in the ‘bot’ subdirectory (var/lib/mysql/bot) have only 280KB. Where is the rest? One more thing — 99% of the database’s size is a text column in one of the tables — I know that mysql stores it in separate files, but does it create one file per record? I found a big file in the var/lib/mysql directory named ibdata1 — its size is over 8GB — what is it? (btw, there are other databases as well in the var/lib/mysql directory).

6 Answers 6

For Example, C:\Program Files\MySQL\MySQL Server 5.1\my.ini

#Path to installation directory. All paths are usually resolved relative to this. basedir="C:/Program Files/MySQL/MySQL Server 5.1/" #Path to the database root datadir="C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/" 

Find the “datadir” , this is the where does MySQL stored the data in Windows.

yongmo@myserver:~$ find / -name my.cnf find: /home/lost+found: Permission denied find: /lost+found: Permission denied /etc/mysql/my.cnf 
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 

Источник

Где хранятся базы данных MySQL

Файлы баз данных в СУБД MySQL хранятся на жёстком диске. По умолчанию все файлы с базами хранятся в директории /var/lib/mysql. Однако это путь можно изменить.

В данной статье будет показано как посмотреть, где хранятся файлы баз данных в СУБД MySQL в операционной системе Ubuntu 20.04.

Читайте также:  Где хранятся ppd linux

Где хранятся базы данных MySQL

По умолчанию все файлы с базами хранятся в директории /var/lib/mysql. Однако, чтобы убедиться в этом можно выполнить команду sudo grep -R ‘datadir’ /etc/mysql/ которая отобразит полный путь до файлов, в которых хранятся базы данных:

sudo grep -R ‘datadir’ /etc/mysql/

B4d7gJs3vPwRAAAAAElFTkSuQmCC

Если перейти по предложенному пути — /var/lib/mysql то в директории будут расположены все необходимые файлы c баз данных. Команду для перехода в директорию необходимо выполнять из-под пользователя root иначе будет ошибка Permission denied:

L3mBbsEyfceGAAAAAElFTkSuQmCC

FqBbNZPll52mdLvzOttetIbHmFwhIC9rjmIuWoy0u8rderDQSJGXPLCrjNN35PL7vwHmbpGYplhiNAAAAABJRU5ErkJggg==

Теперь вы знаете где находятся базы данных MySQL. Также можно выполнить команду mysqld с параметрами —verbose и —help которая отобразит путь хранения файлов с базами данных. Данная команда аналогична предыдущей команде.

mysqld —verbose —help | grep ^datadir

n+RoscPJhsdNwAAAABJRU5ErkJggg==

Если есть необходимость в изменении пути хранения файлов баз данных, то необходимо открыть конфигурационный файл MySQL от имени суперпользователя (root) при помощи любого текстового редактора. В данном примере, как мы узнали выше, конфигурационный файл находится по пути /etc/mysql/mysql.conf.d/mysqld.cnf. Команда для его редактирования будет выглядеть следующим образом:

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

nI6+aCt6MhzZ1RMx7aNs+tKo1GB7f8DfV1aoCxYarwAAAAASUVORK5CYII=

В открывшемся файле необходимо найти блок [mysqld] и в нем параметр с именем datadir в котором можно пописать нужный путь, где будут храниться базы данных. После того как путь был задан необходимо сохранить изменения, закрыть текстовый редактор и перезапустить СУБД при помощи команды:

sudo systemctl restart mysql

weM1MMoOwbgYAAAAABJRU5ErkJggg==

Выводы

В данной короткой статье было рассмотрено, где хранятся базы данных в СУБД MySQL. Также при желании можно изменить директорию для хранения. Есть ли у вас опты работы с СУБД MySQL? Расскажите в комментариях!

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

Источник

where is the actual data in a mysql db stored on a linux machine? [closed]

Which files are the actual files holding the data in the tables in a mysql db? I went to /var/lib/mysql/ and I can see there a bunch of relatively small directories corresponding to my tables, and a lot of files named servername-bin.0000001 etc. Is the data stored in those files?

Читайте также:  Как устанавливать шрифт линукс

4 Answers 4

It is installation specific, but if you’ve /var/lib/mysql , then:

  • MyISAM tables will be stored in individual files in /var/lib/mysql/ databasename /
  • InnoDB resides in /var/lib/mysql/ibdata (unless you’ve used the innodb_per_table setting, in which case it’s stored much like for MyISAM tables)

Check out the ibdata1 file and its ilk.

«Two important disk-based resources managed by the InnoDB storage engine are its tablespace data files and its log files. If you specify no InnoDB configuration options, MySQL creates an auto-extending 10MB data file named ibdata1 and two 5MB log files named ib_logfile0 and ib_logfile1 in the MySQL data directory. To get good performance, you should explicitly provide InnoDB parameters as discussed in the following examples. Naturally, you should edit the settings to suit your hardware and requirements.»

Also see dev.mysql.com/doc/refman/5.1/en/multiple-tablespaces.html if you are trying to recover disk space after dropping tables.

It is stored in various files under that directory, yes. The exact files used depends on what engine the tables are using.

a bunch of relatively small directories corresponding to my tables

Not a tables but databases

that’s binary logs, it has nothing to do with data

why do you need to know, by the way?

Linked

Hot Network Questions

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Оцените статью
Adblock
detector