Wo hat MySQL die Daten auf meiner Festplatte gespeichert?
Hier stelle ich eine einfache Anleitung zur Verfügung, um herauszufinden, wo in der MySQL-Datenbank die Daten auf unserer Festplatte gespeichert sind, sowohl unter Windows als auch unter Linux.
Windows
1) Suchen Sie diemy.ini, die im MySQL-Installationsordner gespeichert sind.
Beispielsweise,
C:\Program Files\MySQL\MySQL Server 5.1\my.ini
2) Öffnen Sie die "my.ini" mit unserem bevorzugten Texteditor.
#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/"
Suchen Sie den "Datadir". Hier hat MySQL die Daten in Windows gespeichert.
Linux
1) Suchen Sie diemy.cnf mit dem Befehlfind / -name my.cnf.
yongmo@myserver:~$ find / -name my.cnf find: /home/lost+found: Permission denied find: /lost+found: Permission denied /etc/mysql/my.cnf
2) Zeigen Sie die my.cnf-Dateicat /etc/mysql/my.cnf an
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
3) Suchen Sie den „Datadir“. Hier speichert MySQL die Daten im Linux-System.