Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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

 
discard

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