Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In what file does mysql store the password hashes and the databases on a linux system? I know that mysql users/hashes are stored in mysql.user, but what file is that? What are the default permissions for that file? Also in which file are the other databases stored?

share|improve this question

The password hashes are stored in the user table of the mysql database. The table files themselves are typically stored in a tree structure under /var/lib/mysql, but that location can be modified by build options or run-time configuration.

share|improve this answer

In debian based distros, that would be /var/lib/mysql/mysql/user.MYD.

In other linux flavors, I'm not sure but you can see where your data dir is by running

mysql> show global variables like 'datadir';
| Variable_name | Value                  |
| datadir       | /usr/local/mysql/data/ |
1 row in set (0.00 sec)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.