SquirrelMail and MySQL
SquirrelMail can use a database backend like MySQL to store address books and preferences. This article describes how to configure SquirrelMail to use a MySQL address book.
yum install1. Install the requirements using the command below.
yum install mysql-server php-pear-DB
Service Configuration2. Start the mysqld service. Learn how to start and stop services here.
Create Postfix Admin db3. Launch the MySQL command line tool using the command below.
mysql -u root -p
The default root password of MySQL is a blank password. Next, create a new MySQL database for SquirrelMail using the commands below.
mysql> CREATE DATABASE squirrelmail;
mysql> CREATE USER squirrelmail@localhost IDENTIFIED BY ‘your_password’;
mysql> GRANT ALL PRIVILEGES ON squirrelmail.* TO squirrelmail;
mysql> USE squirrelmail;
mysql> CREATE TABLE address (
owner varchar(128) DEFAULT » NOT NULL,
nickname varchar(16) DEFAULT » NOT NULL,
firstname varchar(128) DEFAULT » NOT NULL,
lastname varchar(128) DEFAULT » NOT NULL,
email varchar(128) DEFAULT » NOT NULL,
label varchar(255),
PRIMARY KEY (owner,nickname),
KEY firstname (firstname,lastname)
);
mysql> CREATE TABLE global_abook (
owner varchar(128) DEFAULT » NOT NULL,
nickname varchar(16) DEFAULT » NOT NULL,
firstname varchar(128) DEFAULT » NOT NULL,
lastname varchar(128) DEFAULT » NOT NULL,
email varchar(128) DEFAULT » NOT NULL,
label varchar(255),
PRIMARY KEY (owner,nickname),
KEY firstname (firstname,lastname)
);
yum install4. Configure SquirrelMail the command below.
/usr/share/squirrelmail/config/conf.pl
Select menu 9, Database and update the values of the following.
DSN for Address Book : mysql://squirrelmail:password@localhost/squirrelmail
DSN for Global Address Book : mysql://squirrelmail:password@localhost/squirrelmail
Allow writing into Global Address Book : true
Allow listing of Global Address Book : true