티스토리 뷰

데이터베이스/MySQL

MySQL 5.x install

쌀맛나는세상 2009. 4. 7. 15:17

1. download : www.mysql.com
2. tar zxpf /usr/local/src/mysql-5.0.17; cd mysql-5.0.17
3. ./configure --prefix=/usr/local/mysql-5.0.17 --with-charset=euckr

~ 5.0.17 version : euckr -> euc_kr

4. make
5. make install
6. useradd -M -r -d /home/mysql -s /bin/false -c "MySQL.Server" -u 27 mysql
7. scripts/mysql_install_db
8. cd /usr/local
9. ln -s mysql-5.0.17 mysql
10. cp ./mysql/share/mysql/my-large.cnf /etc/my.cnf
11. vi /etc/my.cnf

[mysqld]
thread_concurrency = 8 -> 4
# number of CPU * 2 = 4
innodb_data_home_dir = /usr/local/mysql-4.0.52/var
innodb_log_group_home_dir = /usr/local/mysql-4.0.52/var
innodb_log_arch_dir = /usr/local/mysql-4.0.52/var
innodb_buffer_pool_size = 256M -> 512M
# Physical Mem * 1/2
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 64M -> 128M
# buffer_pool_size * 1/4
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

[myisamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

# caution

innodb_buffer_pool_size + key_buffer_size + max_connections * (sort_buffer_size + read_buffer_size + binlog_cache_size) + max_connections * 2MB <= 2GB

12. cp -p ./mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
13. vi /etc/rc.d/init.d/mysqld

start mode : $bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file >/dev/null 2&1 &
-> $bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file --language=korean >/dev/null 2&1 &

14. chkconfig --level 2345 mysqld on
15. mv /usr/local/mysql/var/* /db
16. rm -rf /usr/local/mysql/var
17. ln -s /db /usr/local/mysql/var
18. chown -R mysql.mysql /db
19. cd
20. vi .bashrc

PATH=$PATH:/usr/local/mysql/bin

21. . .bashrc
22. /etc/rc.d/init.d/mysqld start
23. mysqladmin -u root drop test
24. mysqladmin -u root password 'password'
25. connection test : mysql -u root -p
26. phpMyAdmin

1) download : www.phpmyadmin.net
2) tar zxpf /usr/local/src/phpMyAdmin-***.tar.gz
3) mv phpMyAdmin /yourhomedirectory/MySQLAdmin
4) cd /yourhomedirectory/MySQLAdmin
5) vi config.in.php

$cfg['PmaAbsoluteUri'] = '' -> 'http://yourdomain/MySQLAdmin'
$cfg['Servers'][$i]['auth_type'] = 'config' -> 'http'
$cfg['Servers'][$i]['user'] = 'root' -> ''

6) connection test through web-browser

조금더 수정해야함