mysql 설치
mysql 설치
http://dev.mysql.com/doc/refman/5.1/en/installing-binary.html
1. mysql 다운
wget 을 사용해서 다운.
커뮤니티서버 5.1 Linux (non RPM packages) downloads
mysql-5.1.41-linux-i686-glibc23.tar.gz
2. mysql 계정 만들기. - root를 안쓰고 mysql 이라는 계정으로 mysql을 관리한다.
mkdir /home/mysql
groupadd -g 300 mysql
useradd -u 300 -g 300 -d /home/mysql -s /bin/bash mysql
chown mysql:mysql /home/mysql
3. 다운받은 mysql 을 /user/local로 이동 후 chown을 통해 mysql:mysql로 변경.
이렇게 만들어 준다.
mysql@ubuntu:/usr/local$ ls -l
합계 36
drwxr-xr-x 2 root root 4096 2009-10-10 15:20 bin
drwxr-xr-x 2 root root 4096 2009-10-10 15:20 etc
drwxr-xr-x 2 root root 4096 2009-10-10 15:20 games
drwxr-xr-x 2 root root 4096 2009-10-10 15:20 include
drwxr-xr-x 3 root root 4096 2009-10-10 15:20 lib
lrwxrwxrwx 1 root root 9 2009-10-10 15:20 man -> share/man
lrwxrwxrwx 1 root root 32 2009-10-25 10:47 mysql -> mysql-5.1.40-linux-i686-glibc23/
drwxr-xr-x 13 mysql mysql 4096 2009-10-07 05:28 mysql-5.1.40-linux-i686-glibc23
drwxr-xr-x 2 root root 4096 2009-10-10 15:20 sbin
drwxr-xr-x 5 root root 4096 2009-10-10 15:34 share
drwxr-xr-x 2 root root 4096 2009-10-10 15:20 src
mysql@ubuntu:/usr/local$
4. configure
/usr/local/mysql/support-files/my-large.cnf 파일을 /etc/my.cnf 로 이름을 바꾸어서 복사해준다.
./scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql 실행 해준다.
mysql@ubuntu:/usr/local/mysql$ ./scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h ubuntu password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/
5. mysql 띄우기
mysql 계정으로 사용자를 변경 한 후에 ./mysqld_safe --user=mysql & 이렇게 mysql을 띄운다.
mysql@ubuntu:/usr/local/mysql/bin$ ./mysqld_safe --user=mysql &
[1] 25969
mysql@ubuntu:/usr/local/mysql/bin$ 091025 10:59:20 mysqld_safe Logging to '/usr/local/mysql/data/ubuntu.err'.
091025 10:59:20 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
6. mysql 접속
mysql을 실행하면 끝..
7. 몇 몇 문제해결
mysql@claztec:/usr/local/mysql/bin$ ./mysqladmin stop
./mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
mysqld.sock 없다고 에러가 나는데
/var/run 에 mysqld (mysql:mysql) 을 만들어주고
/etc/my.cnf 에서 mysqld.sock 경로를 다시 잡아주니 잘 되었다
#socket = /tmp/mysqld.sock
socket = /var/run/mysqld/mysqld.sock
--------------------------------------------
또 추가로 발생한 문제점.
부팅할때마다 /var/run/mysqld가 사라진다.
/var/run/mysqld를 /tmp로 심볼릭 링크해 주었다.
너무 대충 보고 정리해서 나중에 보면 뭔 말인지 모를수 있겠다.
Tag // MySQL