install / compile MYSQL 5 on RHEL / CentOS 4

There not much performance difference between MYSQL 4 and 5 as far as you're not using mysqli ext for your PHP scripts, but it nice to find rpms ready on Centos.org which makes the job much easier.

  1.  
  2. yum remove mysql mysql-devel mysql-server
  3. mkdir mysql
  4. cd mysql
  5. wget http://mirror.centos.org/centos/4/centosplus/i386/RPMS/mysqlclient10-3.23.58-9.2.c4.i386.rpm
  6. wget http://mirror.centos.org/centos/4/centosplus/i386/RPMS/mysqlclient10-devel-3.23.58-9.2.c4.i386.rpm
  7. rpm -vih –nodeps mysqlclient*.rpm
  8. wget http://mirror.centos.org/centos/4/centosplus/i386/RPMS/mysql-5.0.27-1.el4.centos.i386.rpm
  9. wget http://mirror.centos.org/centos/4/centosplus/i386/RPMS/mysql-devel-5.0.27-1.el4.centos.i386.rpm
  10. wget http://mirror.centos.org/centos/4/centosplus/i386/RPMS/mysql-server-5.0.27-1.el4.centos.i386.rpm
  11. rpm -vih –nodeps mysql-*.rpm
  12. chkconfig –levels 235 mysqld on
  13. service mysqld start
  14. mysql_install_db –user=mysql
  15. #make sure it’s running
  16. netstat -tap
  17. #if upgrading DB
  18. mysql_fix_privilege_tables -p
  19. #if no privileges set yet
  20. mysqladmin -u root password newpassword
  21.  
  22.  

unless you have really heavy loaded server, this configuration might not make sense or maybe waste your recourses

  1.  
  2. mv /etc/my.cnf /etc/my.cnf.old
  3. vi /etc/mycnf
  4. [mysqld]
  5. #datadir=/var/lib/mysql
  6. #socket=/var/lib/mysql/mysql.sock
  7. skip-locking
  8. skip-innodb
  9. query_cache_limit=1M
  10. query_cache_size=200M
  11. query_cache_type=1
  12. max_connections=2000
  13. interactive_timeout=20
  14. wait_timeout=15
  15. connect_timeout=5
  16. thread_cache_size=500
  17. key_buffer=16M
  18. join_buffer=1M
  19. max_allowed_packet=16M
  20. table_cache=1024
  21. record_buffer=1M
  22. sort_buffer_size=2M
  23. read_buffer_size=2M
  24. max_connect_errors=5
  25. # Try number of CPU’s*2 for thread_concurrency
  26. thread_concurrency=4
  27. myisam_sort_buffer_size=200M
  28. log-bin
  29. server-id=1
  30. [mysql.server]
  31. user=mysql
  32. basedir=/var/lib
  33. [safe_mysqld]
  34. #pid-file=/var/lib/mysql/mysql.pid
  35. open_files_limit=30000
  36. ## logs are good
  37. log-slow-queries
  38. long-query-time=2
  39. log-queries-not-using-indexes
  40. #err-log=/myserver/logs/mysql.error.log
  41. [mysqldump]
  42. quick
  43. max_allowed_packet=16M
  44. [mysql]
  45. no-auto-rehash
  46. #safe-updates
  47. [isamchk]
  48. key_buffer=64M
  49. sort_buffer=64M
  50. read_buffer=16M
  51. write_buffer=16M
  52. [myisamchk]
  53. key_buffer=64M
  54. sort_buffer=64M
  55. read_buffer=16M
  56. write_buffer=16M
  57. [mysqlhotcopy]
  58. interactive-timeout
  59.  

you might need to recompile PHP if your using fcgi


Tags :

This entry was posted on Saturday, June 9th, 2007 at 10:56 pm and is filed under Blog. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

 

Leave a Reply


 Top