MySQL Cookbook

Problem

Your MySQL username and password are stored in your option file, and you don't want other users to be able to read that file.

Solution

Set the file's mode to make it accessible only by you.

Discussion

On a multiple-user operating system such as Unix, you should protect your option file to prevent other users from reading it and finding out how to connect to MySQL using your account. Use chmod to make the file private by setting its mode to enable access only by yourself. Either of the following commands do this:

% chmod 600 .my.cnf % chmod go-rwx .my.cnf

On Windows, you can use Windows Explorer to set file permissions.

Категории