8

Recently I installed MySQL server on my Debian machine using Advanced Packaging Tool, and I'm curious to know where it's installed and how I can find all the source files and user databases.

I've only been able to find the configuration at /etc/mysql, and to find some other small pieces using whereis command and find / -name "mysql", but besides that, nothing much exciting appears on screen.

1
  • What you want to do with the database?
    – Braiam
    Mar 30, 2014 at 20:03

3 Answers 3

12

Debian versions of MySQL packages store the MySQL data in /var/lib/mysql directory by default. You can see this in /etc/mysql/my.cnf file also.

Debian packages don't contain any source code, if that is what you meant by source files. Binaries are installed generally in /usr/bin and /usr/sbin directories.

You can see where the package files are installed by using dpkg -L <packagename> command. Note the capital L letter.

If you want to know the packet name for MySQL, you can use dpkg -l | grep mysql to view all packages that have mysql in their names.

4
  • What about the "internal" database that comes with it (i.e. information_schema, mysql)? Where do I find those files? Mar 30, 2014 at 20:10
  • The mysql database inside MySQL is stored in /var/lib/mysql/mysql directory. information_schema is an internal table created by MySQL, and isn't actually stored anywhere. Mar 30, 2014 at 20:13
  • What about password hashes, user information? Are they stored in plain text? Mar 30, 2014 at 21:03
  • No, they are stored in the mysql.user table, located in the same data directory as other mysql dataabase tables. Mar 30, 2014 at 21:09
1

If it's in your path, try one of these:

which mysql
which mysqld

Edit: InnoDB is now the default engine, and to find its data files, assuming the installation was correctly done, view the /etc/mysql/my.cnf file and look for the lines that contain innodb_data_home_dir and/or innodb_data_file_path.

2
  • This is only for the binaries, I want to search for the whole thing. Mar 30, 2014 at 20:12
  • Answer edited: Try looking in the configuration file for the path.
    – durette
    Mar 30, 2014 at 20:21
0

You have global configuration file - /etc/myysql/my.cnf. Other variables are inside mysql database that is (along with others), in the following location: /var/lib/mysql/.

In fact, what you need is only binary mysql/mysqld/mysqladmin. If you really really wanted to see a whole list mysql server files, then:

  1. assuming you haven't cleaned anything on this machine...
  2. go to folder /var/cache/apt/archives
  3. if you have midnight commander installed (mc packet), then run it and...
  4. go to mentioned folder, search mysql-server file and press F3
  5. This will show you server package content
  6. Of course, there are also other packages (dependent) like mysql-common - look for strong Depends after F3 pressed on selected package.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .