Installing FreeRadius and MySQL on CentOS 5.8

FreeRADIUS is the most widely deployed RADIUS server in the world. It is the basis for multiple commercial offerings. It supplies the AAA needs of many Fortune-500 companies and Tier 1 ISPs. It is also widely used in the academic community, including eduroam. The server is fast, feature-rich, modular, and scalable.

We use MySQL database  as the back-end data store for user and accounting data.

Install FreeRadius and MySQL

# yum -y install freeradius2 freeradius2-mysql freeradius2-utils
# yum -y install mysql mysql-server

Start MySQL and FreeRadius services

# service mysqld start
# service radiusd start

Set the MySQL and FreeRadius services to start on boot

# chkconfig mysqld on
# chkconfig radiusd on

Set the MySQL root password

# mysqladmin -uroot password ’123456′

Create “radius” database

# mysqladmin -uroot -p123456 create radius

Access the MySQL command line

# mysql -uroot -p123456

Create “radius” user

mysql> GRANT all ON radius.* TO radius@localhost IDENTIFIED BY ’123456′;
mysql>  exit;

Import tables to MySQL

# mysql -uradius -p123456 radius < /etc/raddb/sql/mysql/cui.sql
# mysql -uradius -p123456 radius < /etc/raddb/sql/mysql/ippool.sql
# mysql -uradius -p123456 radius < /etc/raddb/sql/mysql/nas.sql
# mysql -uradius -p123456 radius < /etc/raddb/sql/mysql/schema.sql
# mysql -uradius -p123456 radius < /etc/raddb/sql/mysql/wimax.sql

Set “radiusd.conf” file

# gedit /etc/raddb/radiusd.conf

uncomment the line

          $INCLUDE sql.conf

Set “sql.conf” file

# gedit /etc/raddb/sql.conf

set SQL Logging

# Connection info:
server = “localhost”
#port = 3306
login = “radius”
password = “123456″

and uncomment the line

readclients = yes

Set “default” file

# gedit /etc/raddb/sites-enabled/default

in authorize section, uncomment the line


in accounting section, uncomment the line


Access the MySQL command line as “radius” user

# mysql  –uradius  -p123456  radius

and add a test user

mysql> INSERT INTO radcheck (username, attribute, value) VALUES (‘testuser’, ‘Password’, ‘secretmysql’);
mysql>  exit;

Finally test link “FreeRadius & MySQL”

# radtest testuser secretmysql localhost 1812 testing123

If all goes well you should receive

Sending Access-Request of id 123 to port 1812
    User-Name = “testuser”
    User-Password = “secretmysql”
    NAS-IP-Address =
    NAS-Port = 1812
    Message-Authenticator = 0×00000000000000000000000000000000
rad_recv: Access-Accept packet from host port 1812, id=123, length=20