LinuxSecurity.com
Share your story
The central voice for Linux and Open Source security news
Home News Topics Advisories HOWTOs Features Newsletters About Register

Welcome!
Sign up!
EnGarde Community
Login
Polls
What is the most important Linux security technology?
 
Advisories
Community
Linux Events
Linux User Groups
Link to Us
Security Center
Book Reviews
Security Dictionary
Security Tips
SELinux
White Papers
Featured Blogs
All About Linux
DanWalsh LiveJournal
Securitydistro
Latest Newsletters
Linux Security Week: June 29th, 2009
Linux Advisory Watch: June 26th, 2009
Subscribe
LinuxSecurity Newsletters
E-mail:
Choose Lists:
About our Newsletters
RSS Feeds
Get the LinuxSecurity news you want faster with RSS
Powered By

  
mysql security Print E-mail
Source: Ryan W. Maple - Posted by Ryan W. Maple   
Learn tips and tricks Several steps can be taken to secure the default mysql installation.

Introduction

mysql is a free DBMS for many platforms. When you install it there are various unnecessary features enabled that should be disabled to enhance security.

Root Password

When you first install mysql, be it from a source tarball or from a RPM, you must set the 'root' password. This is the password that can be used to control all of the tables, mysql startup/shutdown, etc. To do this type the command;

  mysqladmin -u root password 'new-password'

Default Users and Tables

mysql also ships with two default users and default 'test' tables. The default users are for connecting to the DBMS without specifying a password, so removing these users is obviously a very good security measure. There are also entries so that tables called or starting with 'test' can be world-writable. These should also be disabled for obvious reasons. To do so, you must first go into the DBMS:

  mysql -uroot -p mysql
  Enter password:
  Reading table information for completion of table and column names
  You can turn off this feature to get a quicker startup with -A

  Welcome to the MySQL monitor.  Commands end with ; or g.
  Your MySQL connection id is 1 to server version: 3.22.32

  Type 'help' for help.

Now we execute the two commands to delete the desired entries:

  mysql> DELETE FROM user WHERE User = '';
  mysql> DELETE FROM db WHERE Host = '%';

Disable TCP Networking

If the database only needs to be accessable from the local machine then you should disable TCP networking. By doing so you eliminate the possiblity of people connecting to your daemon without an account on the machine the daemon is running on.

To do this you must edit the file 'safe_mysqld', which is a script file that starts up the daemon for you. It may be in '/usr/bin' or '/usr/local/bin'. Once you locate the file change the following lines (approximate line numbers are included, but they may vary from version to version) by including the --skip-networking flag:

  119:     --skip-locking >> $err_log 2>&1
  119:     --skip-networking --skip-locking >> $err_log 2>&1

  122:     --skip-locking "$@" >> $err_log 2>&1
  122:     --skip-networking --skip-locking "$@" >> $err_log 2>&1

Resources

Write Comment
  • Please keep the topic of messages relevant to the subject of the article.
  • Personal verbal attacks will be deleted.
  • Please don't use comments to plug your web site.. Such material will be removed.
Name:
Title:
Comment:

Code:* Code

Powered by AkoComment!

 
< Prev   Next >
    
Partner:

 

Latest Features
Review: Googling Security: How Much Does Google Know About You
A Secure Nagios Server
Never Installed a Firewall on Ubuntu? Try Firestarter
Review: Hacking Exposed Linux, Third Edition
Security Features of Firefox 3.0
Review: The Book of Wireless
April 2008 Open Source Tool of the Month: sudo
Yesterday's Edition

QuickLinks: Comunity , HOWTOs , Blogs , Features , Book Reviews , Networking ,
  Security Projects ,   Latest News ,  Newsletters ,  SELinux ,  Privacy ,  Home,
 Hardening ,   About Us,   Advertise,   Legal Notice,   RSS,   Guardian Digital
  Home Security Systems, Surveillance Cameras

(c)Copyright 2009 Guardian Digital, Inc. All rights reserved.