MySQL
  Home arrow MySQL arrow Page 6 - Managing MySQL User Accounts
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM developerWorks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MYSQL

Managing MySQL User Accounts
By: Sams Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2006-06-15

    Table of Contents:
  • Managing MySQL User Accounts
  • 4.5.2 Adding New User Accounts to MySQL
  • 4.5.3 Removing User Accounts from MySQL
  • 4.5.5 Assigning Account Passwords
  • 4.5.6 Keeping Your Password Secure
  • 4.5.7.3 Setting Up SSL Certificates for MySQL
  • 4.5.7.4 SSL GRANT Options

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Managing MySQL User Accounts - 4.5.7.3 Setting Up SSL Certificates for MySQL


    (Page 6 of 7 )

    Here is an example for setting up SSL certificates for MySQL:

    DIR=´pwd´/openssl
    PRIV=$DIR/private
    mkdir $DIR $PRIV $DIR/newcerts
    cp /usr/share/ssl/openssl.cnf $DIR
    replace ./demoCA $DIR -- $DIR/openssl.cnf
    # Create necessary files: $database, $serial
    and $new_certs_dir # directory (optional) touch $DIR/index.txt echo "01" > $DIR/serial # # Generation of Certificate Authority(CA) # openssl req -new -x509 -keyout
    $PRIV/cakey.pem -out $DIR/cacert.pem \ -config $DIR/openssl.cnf # Sample output: # Using configuration from
    /home/monty/openssl/openssl.cnf # Generating a 1024 bit RSA private key # ................++++++ # .........++++++ # writing new private key to
    '/home/monty/openssl/private/cakey.pem' # Enter PEM pass phrase: # Verifying password - Enter PEM pass phrase: # ----- # You are about to be asked to enter
    information that will be # incorporated into your certificate request. # What you are about to enter is what is
    called a Distinguished Name # or a DN. # There are quite a few fields but you can
    leave some blank # For some fields there will be a default
    value, # If you enter '.', the field will be left
    blank. # ----- # Country Name (2 letter code) [AU]:FI # State or Province Name (full name)
    [Some-State]:. # Locality Name (eg, city) []: # Organization Name (eg, company) [Internet
    Widgits Pty Ltd]:MySQL AB # Organizational Unit Name (eg, section) []: # Common Name (eg, YOUR name) []:MySQL admin # Email Address []: # # Create server request and key # openssl req -new -keyout $DIR/server-key.pem
    -out \ $DIR/server-req.pem -days 3600 -config
    $DIR/openssl.cnf # Sample output: # Using configuration from
    /home/monty/openssl/openssl.cnf # Generating a 1024 bit RSA private key # ..++++++ # .......... ++++++ # writing new private key to
    '/home/monty/openssl/server-key.pem' # Enter PEM pass phrase: # Verifying password - Enter PEM pass phrase: # ----- # You are about to be asked to enter
    information that will be # incorporated into your certificate request. # What you are about to enter is what is
    called a Distinguished Name # or a DN. # There are quite a few fields but you can
    leave some blank # For some fields there will be a default
    value, # If you enter '.', the field will be left
    blank. # ----- # Country Name (2 letter code) [AU]:FI # State or Province Name (full name)
    [Some-State]:. # Locality Name (eg, city) []: # Organization Name (eg, company) [Internet
    Widgits Pty Ltd]:MySQL AB # Organizational Unit Name (eg, section) []: # Common Name (eg, YOUR name) []:MySQL server # Email Address []: # # Please enter the following 'extra'
    attributes # to be sent with your certificate request # A challenge password []: # An optional company name []: # # Remove the passphrase from the key
    (optional) # openssl rsa -in $DIR/server-key.pem -out
    $DIR/server-key.pem # # Sign server cert # openssl ca -policy policy_anything -out
    $DIR/server-cert.pem \ -config $DIR/openssl.cnf -infiles
    $DIR/server-req.pem # Sample output: # Using configuration from
    /home/monty/openssl/openssl.cnf # Enter PEM pass phrase: # Check that the request matches the
    signature # Signature ok # The Subjects Distinguished Name is as
    follows # countryName :PRINTABLE:'FI' # organizationName :PRINTABLE:'MySQL AB' # commonName :PRINTABLE:'MySQL admin' # Certificate is to be certified until Sep 13
    14:22:46 2003 GMT # (365 days) # Sign the certificate? [y/n]:y # # # 1 out of 1 certificate requests certified,
    commit? [y/n]y # Write out database with 1 new entries # Data Base Updated # # Create client request and key # openssl req -new -keyout
    $DIR/client-key.pem -out \ $DIR/client-req.pem -days 3600 -config
    $DIR/openssl.cnf # Sample output: # Using configuration from
    /home/monty/openssl/openssl.cnf # Generating a 1024 bit RSA private key # .....................................++++++ # ...........................................
    ..++++++ # writing new private key to
    '/home/monty/openssl/client-key.pem' # Enter PEM pass phrase: # Verifying password - Enter PEM pass phrase: # ----- # You are about to be asked to enter
    information that will be # incorporated into your certificate request. # What you are about to enter is what is
    called a Distinguished Name # or a DN. # There are quite a few fields but you can
    leave some blank # For some fields there will be a default
    value, # If you enter '.', the field will be left
    blank. # ----- # Country Name (2 letter code) [AU]:FI # State or Province Name (full name)
    [Some-State]:. # Locality Name (eg, city) []: # Organization Name (eg, company) [Internet
    Widgits Pty Ltd]:MySQL AB # Organizational Unit Name (eg, section) []: # Common Name (eg, YOUR name) []:MySQL user # Email Address []: # # Please enter the following 'extra'
    attributes # to be sent with your certificate request # A challenge password []: # An optional company name []: # # Remove a passphrase from the key (optional) # openssl rsa -in $DIR/client-key.pem -out
    $DIR/client-key.pem # # Sign client cert # openssl ca -policy policy_anything -out
    $DIR/client-cert.pem \ -config $DIR/openssl.cnf -infiles
    $DIR/client-req.pem # Sample output: # Using configuration from
    /home/monty/openssl/openssl.cnf # Enter PEM pass phrase: # Check that the request matches the
    signature # Signature ok # The Subjects Distinguished Name is as
    follows # countryName :PRINTABLE:'FI' # organizationName :PRINTABLE:'MySQL AB' # commonName :PRINTABLE:'MySQL user' # Certificate is to be certified until Sep 13
    16:45:17 2003 GMT # (365 days) # Sign the certificate? [y/n]:y # # # 1 out of 1 certificate requests certified,
    commit? [y/n]y # Write out database with 1 new entries # Data Base Updated # # Create a my.cnf file that you can use to
    test the certificates # cnf="" cnf="$cnf [client]" cnf="$cnf ssl-ca=$DIR/cacert.pem" cnf="$cnf ssl-cert=$DIR/client-cert.pem" cnf="$cnf ssl-key=$DIR/client-key.pem" cnf="$cnf [mysqld]" cnf="$cnf ssl-ca=$DIR/cacert.pem" cnf="$cnf ssl-cert=$DIR/server-cert.pem" cnf="$cnf ssl-key=$DIR/server-key.pem" echo $cnf | replace " " ' ' > $DIR/my.cnf

    To test SSL connections, start the server as follows, where $DIR is the pathname to the directory where the sample my.cnf option file is located:

    shell> mysqld --defaults-file=$DIR/my.cnf &

    Then invoke a client program using the same option file:

    shell> mysql --defaults-file=$DIR/my.cnf

    If you have a MySQL source distribution, you can also test your setup by modifying the preceding my.cnf file to refer to the demonstration certificate and key files in the SSL directory of the distribution.

    More MySQL Articles
    More By Sams Publishing


       · This article is an excerpt from the book "MySQL Administrator's Guide," published by...
     

    Buy this book now. This article is excerpted from the book MySQL Administrator's Guide, written by Paul Dubois (Sams; ISBN: 0672326345). Check it out today at your favorite bookstore. Buy this book now.

       

    MYSQL ARTICLES

    - MySQL Table Prefix Changer Tool in PHP
    - Using the SIGNAL Statement for Error Handling
    - Error Handling Examples
    - Error Handling
    - Completing a Search Engine with MySQL and PH...
    - Paginating Result Sets for a Search Engine B...
    - Building a Search Engine with MySQL and PHP 5
    - Using Boolean Operators for Full Text and Bo...
    - PHP, MySQL and the PEAR Database
    - Working with PHP and MySQL
    - Getting PHP to Talk to MySQL
    - Creating an RSS Reader: the Reader
    - MySQL Security Overview
    - Creating the Admin Script for a PHP/MySQL Bl...
    - Creating the Blog Script for a PHP/MySQL Blo...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway