1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Discuss in my forum

Configuring MySQL for Linux

Configuring MySQL for Linux


On the previous page of this article, we took a look at the process used to configure MySQL on a Windows system. If you're using a Linux system (like the majority of MySQL users), the process is a bit different. Let's take a look.

You have three main tasks to complete the basic configuration of your Linux MySQL server:
  1. Create the grant tables
  2. Start the server
  3. Verify server function
You first create MySQL's grant tables and fill them with the default data used to determine access privileges for the database server. This is accomplished using the mysql_install_db program. First, you need to locate this file. On most installations, you'll find it in either the /bin or /scripts directory under the MySQL root. Once you locate it, run it using the --user=mysql flag.

IMPORTANT NOTE: The initial account settings created by mysql_install_db have no passwords associated with the accounts. After completing this configuration process, you should follow the instructions in the article Securing the Initial MySQL Accounts to secure your server.

Next, it's time to start the server. Simply execute the mysqld_safe program found in the /bin directory under the MySQL root. You should also explicitly provide MySQL with the base directory of the MySQL installation using the --basedir flag. For example, if your base directory is /usr/local/mysql, you'd start the server using the command mysqld --basedir=/usr/local/mysql.

You can verify that the server is up and running using the mysqladmin administrative interface. Simply execute the command mysqladmin version and you'll get output similar to that shown below:

./mysqladmin Ver 8.40 Distrib 4.0.22, for pc-linux on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version 4.0.22
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 45 sec

Threads: 1 Questions: 1 Slow Queries: 1 Opens: 6 Flush Tables: 1 Open Tables: 0 Queries per second avg: 0.022

Once the server is up and running, test it out! Put your SQL knowledge to work and ensure that you're able to create tables and work with data. Don't forget that one of your first tasks should be to add security to the default accounts created during the installation process.
  1. About.com
  2. Technology
  3. Databases
  4. MySQL
  5. Configuring MySQL for Linux

©2014 About.com. All rights reserved.