
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
242
|
Chapter 8: Database Security
If you need to run MySQL as root for some reason, you can chroot the server to help
contain a successful attack. To conserve space and avoid work here, I’ll refer you to
the article at http://www.securityfocus.com/infocus/1726.
Files
Table 8-1 shows where a Red Hat RPM installation puts things. As with any type of
server, file location and ownership can affect security. A little later, I’ll talk about
these files and settings in the my.cnf configuration file(s).
Setting the MySQL root User Password
MySQL account names look like Unix account names, but they are not related. In
particular, MySQL root is the all-powerful MySQL account but has nothing to do
with Linux root. If you try to access MySQL without providing a name, it tries your
Linux account name as the MySQL account name. So, if the Linux root user types:
# mysql
it’s the same as anyone else typing:
% mysql -u root
The initial configuration of MySQL is wide open. If you can get in with:
% mysql -u root
then you need to create a MySQL root password. To set it to newpassword:
mysqladmin -u root password newpassword
You really shouldn’t use the Linux root password as the MySQL root password.
You can even change the name of the MySQL root account, to trip up attackers who
might try to crack its password: ...