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?
2 Answers
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.
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)