DirectAdmin Forums

Go Back   DirectAdmin Forums > Modifications / Add-ons > How-To Guides

Reply
 
Thread Tools Display Modes
  #1  
Old 06-24-2003, 06:05 AM
loopforever loopforever is offline
Verified User
 
Join Date: May 2003
Location: /home/admin
Posts: 298
HOWTO: Optimize MySQL 4.x

Tweak MySQL

I've found that these configuration options posted by "aussie" on the Rackshack forums work well with MySQL 4.x on my machines. I suggest implementing them to alieviate the load MySQL may cause when you run big SQL sites on your server:

Code:
vi /etc/my.cnf [ENTER]
Quote:
[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
skip-locking
skip-innodb
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
log-bin
server-id=1

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
#pid-file=/var/lib/mysql/mysql.pid
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
Code:
/etc/rc.d/init.d/mysqld restart [ENTER]
__________________
Matt Savona
serveIO
Creator of the DirectAdmin Enhanced Theme
Reply With Quote
  #2  
Old 11-27-2003, 02:04 PM
MQ-James MQ-James is offline
Verified User
 
Join Date: Aug 2003
Posts: 29
thanks, this helps. How can I enable certain other host maks to access the server? I don't want all TLDs to be able to access, just ones on server and 2 other TLDs
Reply With Quote
  #3  
Old 11-27-2003, 05:04 PM
loopforever loopforever is offline
Verified User
 
Join Date: May 2003
Location: /home/admin
Posts: 298
Directadmin can handle host access in the database area of the user control panel. You can also control this through phpMyAdmin under your MySQL root user.

Hope this helps.
__________________
Matt Savona
serveIO
Creator of the DirectAdmin Enhanced Theme
Reply With Quote
  #4  
Old 11-27-2003, 07:01 PM
FarCry's Avatar
FarCry FarCry is offline
Verified User
 
Join Date: Jun 2003
Location: Perth, Australia
Posts: 280
log into phpmyadmin with the username da_admin and your admin password (the original one)
__________________
Mark Harris
mharris@octane-design.biz
Reply With Quote
  #5  
Old 11-28-2003, 01:30 PM
DirectAdmin Support DirectAdmin Support is offline
Administrator
 
Join Date: Feb 2003
Posts: 6,693
Hello,

DirectAdmin does have the mysql hosts feature.. Just click your database name, and the "Access Hosts" table should be at the bottom.

John
Reply With Quote
  #6  
Old 04-11-2004, 08:39 PM
neorder neorder is offline
Verified User
 
Join Date: Oct 2003
Posts: 388
i'm sorry but i don't find "/etc/my.cnf" in my server, is that how to compatible with DA?

do i just creat a new file and copy the content there?

btw, i've nothing at /var/log/mysql.log

is there anything wrong here at my server?

Last edited by neorder; 04-11-2004 at 08:44 PM.
Reply With Quote
  #7  
Old 04-11-2004, 09:25 PM
existenz's Avatar
existenz existenz is offline
Verified User
 
Join Date: Jul 2003
Location: /dev/null
Posts: 607
The my.cnf it not added during the default install. You can search the forums for more information about this but you can basically add what was posted as a new file called my.cnf.
Reply With Quote
  #8  
Old 04-11-2004, 10:01 PM
ProWebUK's Avatar
ProWebUK ProWebUK is offline
Administrator
 
Join Date: Jun 2003
Location: UK
Posts: 2,326
MySQL simply runs on defaults unless the my.cnf exists, there are actually 3 places it looks for the config with /etc/my.cnf just being the first... add them and it will override the default settings..

Chris
__________________
OptimumServers » Managed Dedicated Servers & General Systems Management » Coming Soon!
ProWebUK - Quality Web Services
DirectAdmin Server Checklist
Reply With Quote
  #9  
Old 04-13-2004, 07:10 AM
neorder neorder is offline
Verified User
 
Join Date: Oct 2003
Posts: 388
thanks, i will read more.
Reply With Quote
  #10  
Old 04-23-2004, 07:20 PM
Anzix Anzix is offline
Verified User
 
Join Date: Aug 2003
Location: portland
Posts: 39
Hello, I need some help:

[root]# /etc/rc.d/init.d/mysqld restart
Killing mysqld with pid 2812
Wait for mysqld to exit\c
.\c
.\c
.\c
.\c
.\c
done
[root]# /etc/rc.d/init.d/mysqld restart
No mysqld pid file found. Looked for /var/lib/mysql/purple.nemesis.net.pid.
[root]# Starting mysqld daemon with databases from /var/lib/mysql
040423 18:18:11 mysqld ended

[root]# service mysqld restart
No mysqld pid file found. Looked for /var/lib/mysql/purple.nemesis.net.pid.
[root]# Starting mysqld daemon with databases from /var/lib/mysql
040423 18:40:31 mysqld ended

any idea on how to fix it?

Last edited by Anzix; 04-23-2004 at 07:42 PM.
Reply With Quote
  #11  
Old 04-24-2004, 06:15 AM
loopforever loopforever is offline
Verified User
 
Join Date: May 2003
Location: /home/admin
Posts: 298
Have you modified this my.cnf file at all? I think mysqld is looking for the pid file in one location that you have specified, but it is non-existant.
__________________
Matt Savona
serveIO
Creator of the DirectAdmin Enhanced Theme
Reply With Quote
  #12  
Old 04-29-2004, 02:39 PM
sander815 sander815 is offline
Verified User
 
Join Date: Jul 2003
Posts: 474
i had a problem with mysql server going down, because google bots tried to login a lot, causing many many cookies etc

we now blocked google from entering the forums, that solved it, but will this maybe prevent mysql going down?
Reply With Quote
  #13  
Old 05-02-2004, 01:14 PM
sander815 sander815 is offline
Verified User
 
Join Date: Jul 2003
Posts: 474
in what way is this cnf better then the default 1?
Reply With Quote
  #14  
Old 05-05-2004, 07:58 AM
neorder neorder is offline
Verified User
 
Join Date: Oct 2003
Posts: 388
Quote:
Originally posted by sander815
in what way is this cnf better then the default 1?
good question, i shouldn't just copy blindly, i just read the original post from ev1, it looks for different server specs, the setting varies.
Reply With Quote
  #15  
Old 05-05-2004, 08:20 AM
neorder neorder is offline
Verified User
 
Join Date: Oct 2003
Posts: 388
they recommand

Quote:
suggest the following my.cnf changes for people with a single-processor server and 512MB RAM:

thread_cache_size=50
key_buffer=40M
table_cache=384
sort_buffer_size=768K
read_buffer_size=512K
read_rnd_buffer_size=512K
thread_concurrency=2
how are these values are calculated?

anyway, i did this optimization, it was a WOW when i see the out come, i have one site used to have 0.2 page generate speed, now it's only 0.08!

a small question is

Quote:
/etc/rc.d/init.d/mysqld restart [ENTER]
doesn't look like work, i ran it, but it hangs...i don't know if it's restarted, i guess it did.
Reply With Quote
  #16  
Old 05-11-2004, 12:57 AM
sander815 sander815 is offline
Verified User
 
Join Date: Jul 2003
Posts: 474
to m it seems this config is best suited if you have 1.5 gb ram

key_buffer_size = (record_buffer + sort_buffer)*max_connections
= 1500
Reply With Quote
  #17  
Old 05-19-2004, 04:24 PM
sander815 sander815 is offline
Verified User
 
Join Date: Jul 2003
Posts: 474
on what thread is this onfo based upon? on ev1 servers
Reply With Quote
  #18  
Old 05-19-2004, 04:41 PM
ProWebUK's Avatar
ProWebUK ProWebUK is offline
Administrator
 
Join Date: Jun 2003
Location: UK
Posts: 2,326
Quote:
Originally posted by sander815
on what thread is this onfo based upon? on ev1 servers
it doesn't matter who provided the server - mysql is simply - mysql and this will work on any DA server, from any provider. (providing it has mysql and uses the linux mysql setup - if it had DA it would )
__________________
OptimumServers » Managed Dedicated Servers & General Systems Management » Coming Soon!
ProWebUK - Quality Web Services
DirectAdmin Server Checklist
Reply With Quote
  #19  
Old 05-21-2004, 06:41 AM
sander815 sander815 is offline
Verified User
 
Join Date: Jul 2003
Posts: 474
no, i mean, i wanted to know the link to the thread on rack shack forums where this info comes from, so i can check what peoples replys are there
Reply With Quote
  #20  
Old 06-03-2004, 06:35 AM
netswitch netswitch is offline
Verified User
 
Join Date: Dec 2003
Location: Belgium
Posts: 156
any idea of the values to change for a dual processor ?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql / Ownership (wrong) Zoner CustomBuild 6 10-28-2007 10:34 AM
How to delete all temp and waste files !! ? rahulw Admin-Level Difficulties 10 06-02-2007 03:38 PM
Lots of MySql sessions open chartmusic MySQL / PHP 4 03-13-2007 06:28 AM
Mysql Error bigboy MySQL / PHP 0 05-20-2006 01:27 AM
HOWTO: Convert to courier imap using mysql ballyn How-To Guides 81 12-26-2005 06:55 AM


All times are GMT -7. The time now is 07:32 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
DirectAdmin © 2007 JBMC Software