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: October 20th, 2014
Linux Advisory Watch: October 17th, 2014
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
User Rating:      How can I rate this item?
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

Only registered users can write comments.
Please login or register.

Powered by AkoComment!

 
< Prev   Next >
    
Partner

 

Latest Features
Peter Smith Releases Linux Network Security Online
Securing a Linux Web Server
Password guessing with Medusa 2.0
Password guessing as an attack vector
Squid and Digest Authentication
Squid and Basic Authentication
Demystifying the Chinese Hacking Industry: Earning 6 Million a Night
Free Online security course (LearnSIA) - A Call for Help
What You Need to Know About Linux Rootkits
Review: A Practical Guide to Fedora and Red Hat Enterprise Linux - Fifth Edition
Yesterday's Edition
Hacker Halted 2014: Johnny Long Calls for Hackers for Charity Volunteers
RIPS – Static Source Code Analysis For PHP Vulnerabilities
Finding a Video Poker Bug Made These Guys Rich—Then Vegas Made Them Pay
Partner Sponsor

Community | HOWTOs | Blogs | Features | Book Reviews | Networking
 Security Projects |  Latest News |  Newsletters |  SELinux |  Privacy |  Home
 Hardening |   About Us |   Advertise |   Legal Notice |   RSS |   Guardian Digital
(c)Copyright 2014 Guardian Digital, Inc. All rights reserved.