How to install DBD::mysql in directadmin

To install DBI and DBD:mysql from source, run the following:

wget http://www.cpan.org/modules/by-module/DBD/DBI-1.608.tar.gz
tar xvzf DBI-1.608.tar.gz
cd DBI-1.608
unset LANG;
perl Makefile.PL
make
make install

cd ..
wget http://www.cpan.org/modules/by-module/DBD/DBD-mysql-3.0002.tar.gz
tar xvzf DBD-mysql-3.0002.tar.gz
cd DBD-mysql-3.0002
unset LANG;
perl Makefile.PL
make
make install

You can also install it using the cpan mirrors as follows,

perl -MCPAN -e 'install Bundle::DBD::mysql'

How to install suphp in directadmin

Directadmin came with php ad CLI options. So the php scripts run as apache user.  You can use suphp , which help the php run as local user.  Dircetadmin  support suphp without much issues.  Please  use the following steps to  enable suphp in directadmin.

cd /usr/local/directadmin/custombuild/
./build clean
./build update
./build set php5_cgi yes
./build set php5_cli no
./build all d
./build rewrite_confs

Now you  installed suphp in the server

You may need to rewrite the webapps php scripts to reset the ownerships if you get internal server errors with them, eg:

./build roundcube
./build squirrelmail
./build phpmyadmin

Please make sure  to change all 777 folders to 755  permission and change all 777 php scripts to 644 permission , otherwise you will get 500 internal server error  in your wesbites.

How to rest mysql root password in directadmin

When connecting to the MySQL screens in DirectAdmin, if this error appears, that would indicated that the “da_admin” user has not been setup correctly.  Also you are reset the mysql root password too. To resolve this do the following.

/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables &

That should start up mysql without the need for a root password.  Once in, type

mysql
use mysql;
update user set Password=PASSWORD('newpass') where user='root';
GRANT ALL PRIVILEGES ON *.* TO 'da_admin'@'localhost' IDENTIFIED BY 'newpass' WITH GRANT OPTION;
FLUSH PRIVILEGES;
quit;

Now we need to make sure it’s setup correctly for DA to use.   Edit /usr/local/directadmin/conf/mysql.conf and set

user=da_admin
passwd=newdapass

Now edit the file /root/.my.cnf  and add the following lines

[client]
pass="newpass"
user=root