Archive for the 'DirectAdmin Support' Category

SBDavid

To move mysql to another partition

To move mysql to another partition.

If you have a /var partition, and if that partition is too small it may fill up quickly. If you want to move the data which is stored in “/var” to another partition, run the following:

cd /var
du -h | sort -n

This will give you a full readout of all the directories that are using the most space. The directory using the most disk space will appear at the bottom of the list.

One common culprit is mysql (/var/lib/mysql on Redhat). To move that path to another partition, run the following:

cd /home
mkdir mysql
chown mysql:mysql mysql
cd mysql
/sbin/service mysqld stop
cp -Rp /var/lib/mysql/* .
cd /var/lib
mv mysql mysql_old
ln -s /home/mysql ./mysql
/sbin/service mysqld start

Once satisfied that mysqld is running, remove the old data:

rm -rf mysql_old

Error connecting to MySQL: Access denied for user: ‘da_admin@localhost’ (Using password: YES) 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. To resolve this do the following.

1) Make sure the root mysql password works. If you know it, skip to 2). The mysql root password can be found in the /usr/local/directadmin/scripts/setup.txt if it has not been deleted. It’s under the header “mysql=”. If it cannot be found, then mysqld will have to be restarted with the –skip-grant-tables option:

service mysqld stop
mysqld_safe –skip-grant-tables &

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

use mysql
UPDATE user SET password=PASSWORD(’newpass’) WHERE user=’root’;
FLUSH PRIVILEGES;
quit

That will reset the root password for you.

Type “killall -9 mysqld_safe; killall -9 mysqld” to shut down mysqld.
Start it up again with

/sbin/service mysqld start

2) Once the root mysql password is set and known, then you can begin the process of resetting the da_admin mysql user. Type:

mysql -uroot -p

Then press enter. You’ll be asked for the password. Once in mysql, type:

GRANT ALL PRIVILEGES ON *.* TO da_admin@localhost IDENTIFIED BY ‘newdapass’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
quit

That should set the password for da_admin in mysql.

3) 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

4) Test it out in DirectAdmin.

How to Add Custom Modules to php in DirectAdmin

If you want to add any extra modules to php, they’ll most likely need to be compiled in. Any module that needs to be compiled in will have a –with-module type flag which will need to be used. To add this flag, run the following:

cd /usr/local/directadmin/customapache
vi configure.php
#add your –with-module line to the end of the file,
# and make sure the \ character exists at the end of all lines except the last one.
./build clean
./build php

If you’re using custombuild instead of customapache, use the following configure file(s) then repeat the above steps, but use ‘custombuild’ instead of ‘customapache’ in the path:

/usr/local/directadmin/custombuild/configure/ap2/configure.php5
/usr/local/directadmin/custombuild/configure/ap2/configure.php4

Then restart apache

SBDavid

Setting up remote mysql server on DA

Setting up remote mysql server on DA

Make sure that port 3306 is open on the remote box.

Basically, you just run the “GRANT ALL PRIVILEGES ON *.* TO da_admin@localhost” command again, but you change localhost to the IP of your DA server.

GRANT ALL PRIVILEGES ON *.* TO user@16.15.4.1 WITH GRANT OPTION;
FLUSH PRIVILEGES;

Test it out by logging into your DA machine via ssh, and type:

mysql -uda_admin -p –host=16.15.4.1
SBDavid

Optimize MySQL 4

Optimize MySQL 4

If you are using MySQL 5 and having 2+GB RAM, then use /usr/share/mysql/my-large.cnf

If you’ve got mysql 4 (and not mysql 5), then you can use the following code in your /etc/my.cnf:

[mysqld]
local-infile=0
skip-locking
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_connections=500
interactive_timeout=100
wait_timeout=100
connect_timeout=10
thread_cache_size=128
key_buffer=16M
join_buffer=1M
max_allowed_packet=16M
table_cache=1024
record_buffer=1M
sort_buffer_size=2M
read_buffer_size=2M
max_connect_errors=10
# Try number of CPU’s*2 for thread_concurrency
thread_concurrency=2
myisam_sort_buffer_size=64M
server-id=1

[safe_mysqld]
err-log=/var/log/mysqld.log
open_files_limit=8192

[mysqldump]
quick
max_allowed_packet=16M

[mysql]
no-auto-rehash
#safe-updates

[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[mysqlhotcopy]
interactive-timeout

« Prev - Next »