[root@MySQL stage]# cd /usr/local/
[root@MySQL local]# mkdir mysql
[root@MySQL local]# cd /usr/local/mysql/
[root@MySQL mysql]# cp -r /stage/mysql-5.0.51a-linux-i686-glibc23/ ./
[root@MySQL mysql]# ls
mysql-5.0.51a-linux-i686-glibc23
[root@MySQL mysql]# cd mysql-5.0.51a-linux-i686-glibc23/
[root@MySQL mysql-5.0.51a-linux-i686-glibc23]# ls
bin docs lib scripts tests
configure EXCEPTIONS-CLIENT man share
COPYING include mysql-test sql-bench
data INSTALL-BINARY README support-files
[root@MySQL mysql-5.0.51a-linux-i686-glibc23]# pwd
/usr/local/mysql/mysql-5.0.51a-linux-i686-glibc23
[root@MySQL mysql-5.0.51a-linux-i686-glibc23]# mv * ../
[root@MySQL mysql-5.0.51a-linux-i686-glibc23]# ls
[root@MySQL mysql-5.0.51a-linux-i686-glibc23]# cd ..
[root@MySQL mysql]# ls
bin EXCEPTIONS-CLIENT mysql-5.0.51a-linux-i686-glibc23 sql-bench
configure include mysql-test support-files
COPYING INSTALL-BINARY README tests
data lib scripts
docs man share
[root@MySQL mysql]# rm -rf mysql-5.0.51a-linux-i686-glibc23/
[root@MySQL mysql]# ls
bin docs lib scripts tests
configure EXCEPTIONS-CLIENT man share
COPYING include mysql-test sql-bench
data INSTALL-BINARY README support-files
컴파일 버전 설치 예정
configure
make
make install
3단계 설치
[root@MySQL mysql]# ./scripts/mysql_install_db
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 MySQL.ocmkorea.com 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 on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[root@MySQL mysql]# groupadd mysql
[root@MySQL mysql]# useradd -g mysql mysql
[root@MySQL mysql]# chown -R root /usr/local/mysql
[root@MySQL mysql]# chown -R mysql /usr/local/mysql/data
[root@MySQL mysql]# chown -R root /usr/local/mysql/bin
[root@MySQL mysql]# chown -R mysql /usr/local/mysql
[root@MySQL mysql]# ./bin/safe_mysqld --user=mysql &
[1] 5076
[root@MySQL mysql]# Starting mysqld daemon with databases from /usr/local/mysql/data
[root@MySQL mysql]# ps -ef | grep mysql
root 5076 4860 0 10:13 pts/4 00:00:00 /bin/sh ./bin/safe_mysqld --user=mysql
mysql 5096 5076 1 10:13 pts/4 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --pid-file=/usr/local/mysql/data/MySQL.ocmkorea.com.pid --skip-external-locking
root 5112 4860 0 10:13 pts/4 00:00:00 grep mysql
[root@MySQL mysql]# ./bin/mysqladmin -u root password "mysql00"
[root@MySQL mysql]# ./bin/mysql -p mysql
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.51a MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql> use test
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| func |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| proc |
| procs_priv |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
17 rows in set (0.00 sec)
mysql> show engines;
+------------+----------+----------------------------------------------------------------+
| Engine | Support | Comment |
+------------+----------+----------------------------------------------------------------+
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys |
| BerkeleyDB | NO | Supports transactions and page-level locking |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) |
| EXAMPLE | YES | Example storage engine |
| ARCHIVE | YES | Archive storage engine |
| CSV | YES | CSV storage engine |
| ndbcluster | DISABLED | Clustered, fault-tolerant, memory-based tables |
| FEDERATED | YES | Federated MySQL storage engine |
| MRG_MYISAM | YES | Collection of identical MyISAM tables |
| ISAM | NO | Obsolete storage engine |
+------------+----------+----------------------------------------------------------------+
12 rows in set (0.00 sec)
mysql> show processlist;
+----+------+-----------+-------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+-------+---------+------+-------+------------------+
| 2 | root | localhost | mysql | Query | 0 | NULL | show processlist |
+----+------+-----------+-------+---------+------+-------+------------------+
1 row in set (0.00 sec)
mysql> select version(), current_date(), current_user();
+-----------+----------------+----------------+
| version() | current_date() | current_user() |
+-----------+----------------+----------------+
| 5.0.51a | 2015-12-24 | root@localhost |
+-----------+----------------+----------------+
1 row in set (0.00 sec)
mysql> use information_schema
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> create table mountain(name varchar(10) not null primary key, height int(4) not null, position varchar(20)) engine=myisam default charset=utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> show table status;
+----------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+----------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------+
| mountain | MyISAM | 10 | Dynamic | 0 | 0 | 0 | 281474976710655 | 1024 | 0 | NULL | 2015-12-24 10:23:13 | 2015-12-24 10:23:13 | NULL | utf8_general_ci | NULL | | |
+----------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------+
1 row in set (0.00 sec)
mysql> show create table mountain;
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| mountain | CREATE TABLE `mountain` (
`name` varchar(10) NOT NULL,
`height` int(4) NOT NULL,
`position` varchar(20) default NULL,
PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show table status\G
*************************** 1. row ***************************
Name: mountain
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 0
Avg_row_length: 0
Data_length: 0
Max_data_length: 281474976710655
Index_length: 1024
Data_free: 0
Auto_increment: NULL
Create_time: 2015-12-24 10:23:13
Update_time: 2015-12-24 10:23:13
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.00 sec)
이제 연동작업 시작
--Apatch & PHP
[root@MySQL local]# pwd
/usr/local
[root@MySQL local]# mkdir apache php
[root@MySQL local]# ls
apache bin etc games include lib libexec mysql php sbin share src
[root@MySQL local]# cd apache/
[root@MySQL apache]# cp -r /stage/apache_1.3.39/ ./
[root@MySQL apache]# ls
apache_1.3.39
[root@MySQL apache]# cd ../php/
[root@MySQL php]# cp -r /stage/php-5.2.5/ ./
[root@MySQL php]# ls
php-5.2.5
[root@MySQL apache]# cd apache_1.3.39/
[root@MySQL apache_1.3.39]# mv * ../
[root@MySQL apache_1.3.39]# cd ..
[root@MySQL apache]# ls
ABOUT_APACHE htdocs NOTICE README.configure
apache_1.3.39 icons NWGNUenvironment.inc README-WIN.TXT
cgi-bin INSTALL NWGNUhead.inc src
conf LICENSE NWGNUmakefile WARNING-WIN.TXT
config.layout logs NWGNUtail.inc
configure Makefile.tmpl README
[root@MySQL apache]# rm -rf apache_1.3.39/
[root@MySQL apache]# ls
ABOUT_APACHE htdocs Makefile.tmpl NWGNUtail.inc WARNING-WIN.TXT
cgi-bin icons NOTICE README
conf INSTALL NWGNUenvironment.inc README.configure
config.layout LICENSE NWGNUhead.inc README-WIN.TXT
configure logs NWGNUmakefile src
[root@MySQL apache]# cd ../php/
[root@MySQL php]# cd php-5.2.5/
[root@MySQL php-5.2.5]# mv * ../
[root@MySQL php-5.2.5]# ls
[root@MySQL php-5.2.5]# cd ..
[root@MySQL php]# ls
acconfig.h main README.SUBMITTING_PATCH
acconfig.h.in makedist README.TESTING
acinclude.m4 Makefile.frag README.TESTING2
aclocal.m4 Makefile.gcov README.UNIX-BUILD-SYSTEM
build Makefile.global README.UPDATE_5_2
buildconf makerpm README.WIN32-BUILD-SYSTEM
buildconf.bat missing README.Zeus
CODING_STANDARDS mkinstalldirs regex
config.guess netware run-tests.php
config.sub NEWS sapi
configure pear scripts
configure.in php-5.2.5 server-tests-config.php
CREDITS php5.spec.in server-tests.php
cvsclean php.gif snapshot
cvsclean.bat php.ini-dist stamp-h.in
ext php.ini-recommended stub.c
EXTENSIONS README.CVS-RULES tests
footer README.EXTENSIONS TODO
generated_lists README.EXT_SKEL TODO-5.1
genfiles README.input_filter TODO-PHP5
header README.PARAMETER_PARSING_API TSRM
INSTALL README.PHP4-TO-PHP5-THIN-CHANGES UPGRADING
install-sh README.QNX win32
LICENSE README.SELF-CONTAINED-EXTENSIONS Zend
ltmain.sh README.STREAMS
[root@MySQL php]# rm -rf php-5.2.5/
[root@MySQL apache]# vi README
설치방법 등이 있음
[root@MySQL apache]# ./configure --prefix=/usr/local/apache/
Configuring for Apache, Version 1.3.39
+ using installation path layout: Apache (config.layout)
Creating Makefile
Creating Configuration.apaci in src
Creating Makefile in src
+ configured for Linux platform
+ setting C compiler to gcc
+ setting C pre-processor to gcc -E
+ using "tr [a-z] [A-Z]" to uppercase
+ checking for system header files
+ adding selected modules
+ using system Expat
+ checking sizeof various data types
+ doing sanity check on compiler and options
Creating Makefile in src/support
Creating Makefile in src/regex
Creating Makefile in src/os/unix
Creating Makefile in src/ap
Creating Makefile in src/main
Creating Makefile in src/modules/standard
이제 아파치와 mysql php를 연동하기 위해 다른 옵션을 사용한다
[root@MySQL apache]# cd ../php/
[root@MySQL php]# pwd
/usr/local/php
[root@MySQL php]# ./configure --with-apache=/usr/local/apache/ \
> --with-mysql=/usr/local/mysql/ \
> --with-zlib=/usr/
~중략
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
[root@MySQL php]# make
~중략~
Build complete.
Don't forget to run 'make test'.
[root@MySQL php]# make install
Installing PHP SAPI module: apache
Installing PHP CLI binary: /usr/local/bin/
Installing PHP CLI man page: /usr/local/man/man1/
Installing build environment: /usr/local/lib/php/build/
Installing header files: /usr/local/include/php/
Installing helper programs: /usr/local/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/lib/php/
[PEAR] Console_Getopt - installed: 1.2.3
[PEAR] Archive_Tar - installed: 1.3.2
[PEAR] Structures_Graph- installed: 1.0.2
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
[PEAR] PEAR - installed: 1.6.1
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
Installing PDO headers: /usr/local/include/php/ext/pdo/
아파치 설치시 필요 파일 복사
[root@MySQL php]# cd /usr/local/php/libs/
[root@MySQL libs]# ls
libphp5.a libphp5.la
[root@MySQL libs]# cp libphp5.a /usr/local/apache/src/modules/php5/
아파치 configure를 다시 php를 돌렸기에 수정 다시 함
[root@MySQL apache]# pwd
/usr/local/apache
[root@MySQL apache]# ./configure --prefix=/usr/local/apache/ --activate-module=src/modules/php5/libphp5.a
Configuring for Apache, Version 1.3.39
+ using installation path layout: Apache (config.layout)
+ activated php5 module (modules/php5/libphp5.a)
Creating Makefile
Creating Configuration.apaci in src
Creating Makefile in src
+ configured for Linux platform
+ setting C compiler to gcc
+ setting C pre-processor to gcc -E
+ using "tr [a-z] [A-Z]" to uppercase
+ checking for system header files
+ adding selected modules
o php5_module uses ConfigStart/End
+ using system Expat
+ checking sizeof various data types
+ doing sanity check on compiler and options
Creating Makefile in src/support
Creating Makefile in src/os/unix
Creating Makefile in src/ap
Creating Makefile in src/main
Creating Makefile in src/modules/standard
Creating Makefile in src/modules/php5
변경된걸 방지하기 위한 다시 한번 더 카피
[root@MySQL libs]# pwd
/usr/local/php/libs
[root@MySQL libs]# cp libphp5.a /usr/local/apache/src/modules/php5/
cp: overwrite `/usr/local/apache/src/modules/php5/libphp5.a'? y
[root@MySQL libs]# cd /usr/local/apache/
[root@MySQL apache]# make && make install
~중략~
+--------------------------------------------------------+
| You now have successfully built and installed the |
| Apache 1.3 HTTP server. To verify that Apache actually |
| works correctly you now should first check the |
| (initially created or preserved) configuration files |
| |
| /usr/local/apache/conf/httpd.conf
| |
| and then you should be able to immediately fire up |
| Apache the first time by running: |
| |
| /usr/local/apache/bin/apachectl start
| |
| Thanks for using Apache. The Apache Group |
| http://www.apache.org/ |
+--------------------------------------------------------+
php의 참조파일을 OS의 경로에 카피
[root@MySQL apache]# cd ../php/
[root@MySQL php]# cp ./php.ini-dist /usr/local/lib/php.ini
아파치 구성 시작
[root@MySQL apache]# pwd
/usr/local/apache
[root@MySQL apache]# cd conf
[root@MySQL conf]# ls
access.conf httpd.conf-dist mime.types.default
access.conf.default httpd.conf-dist-nw srm.conf
access.conf-dist httpd.conf-dist-win srm.conf.default
highperformance.conf-dist magic srm.conf-dist
httpd.conf magic.default
httpd.conf.default mime.types
[root@MySQL conf]# vi httpd.conf
:277 277라인으로 와서 hostname 체크 웹 브라우저상에서 이거를 사용할 수 있음
277 ServerName MySQL.ocmkorea.com
웹 페이지의 첫번째 페이지
:363 라인으로 간다
363 DirectoryIndex index.html index.php index.php5 index.php4 index.htm
:757 라인으로 간다
758 AddType image/x-icon .ico
759 AddType application/x-httpd-php .php4 .php5 .phtml .php .inc
760 AddType text/html .shtml .html .htm
이제 저장하고 나감
보통 이런 configuration file을 수정하면 서비스를 내렸다 올린다.
[root@MySQL conf]# cd ..
[root@MySQL apache]# ./bin/apachectl start
./bin/apachectl start: httpd started
[root@MySQL apache]# ps -ef | grep httpd
root 4881 1 0 11:14 ? 00:00:00 /usr/local/apache/bin/httpd
nobody 4882 4881 0 11:14 ? 00:00:00 /usr/local/apache/bin/httpd
nobody 4883 4881 0 11:14 ? 00:00:00 /usr/local/apache/bin/httpd
nobody 4884 4881 0 11:14 ? 00:00:00 /usr/local/apache/bin/httpd
nobody 4885 4881 0 11:14 ? 00:00:00 /usr/local/apache/bin/httpd
nobody 4886 4881 0 11:14 ? 00:00:00 /usr/local/apache/bin/httpd
root 4889 4860 0 11:14 pts/4 00:00:00 grep httpd
[root@MySQL htdocs]# cp index.html.kr.iso-kr index.html.kr.iso-kr.org
[root@MySQL htdocs]# mv index.html.kr.iso-kr index.html
이렇게 하고 인터넷 익스플로러에서 http://192.168.137.80를 입력하면 아파치 화면이 뜬다
[root@MySQL htdocs]# pwd
/usr/local/apache/htdocs
[root@MySQL htdocs]# vi test.php
<?
phpinfo();
?>
그 후에 http://192.168.137.80/test.php 하면 php화면이 뜬다
zb4pl8.zip는 제로보드를 만드는 파일
[root@MySQL stage]# mv bbs /usr/local/apache/htdocs/
[root@MySQL htdocs]# ls
apache_pb.gif index.html.he.iso8859-8 index.html.ru.cp-1251
bbs index.html.hu index.html.ru.cp866
파일 자체가 완성품이라 몇가지만 수정하면 됨
[root@MySQL bbs]# vi schema.sql
144 total_article int(20) default 0 not null,
144 total_article int(20) not null, <- 이렇게 수정
저장 나감
웹 브라우저에 입력 http://192.168.137.80/bbs/install.php 하면 제로보드 설치 화면 뜸
권한 변경
[root@MySQL htdocs]# chmod -R 707 bbs/
웹 화면에서 설치 시작 클릭 후 web 화면상의 설정 시작
이 게시판에 들어오는 데이터는 test DB에 넣겠다는 뜻
관리자 계정은 admin으로 만들었고 그 계정으로 로그인 시 제로보드 게시판에 뜸
스크립트를 돌리기 위한 파일 복사
[root@MySQL stage]# ls
apache_1.3.39 haksaDB_table.sql webalizer-2.21-02
employees.sql mysql-5.0.51a-linux-i686-glibc23
haksaDB_data.sql php-5.2.5
vi .bash_profile
alias mys='/usr/local/mysql/bin/mysql'
DB 생성
mysql> create database empdb;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| empdb |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)
empdb의 모든 권한을 주고 권한 초기화까지 진행
mysql> grant all privileges on empdb.* to emp_damin@localhost identified by 'mysql00' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@MySQL mysql]# mys -u emp_damin -p empdb
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 33
Server version: 5.0.51a MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
'스터디북' 카테고리의 다른 글
<12/27> Rac11g ASM (0) | 2015.12.27 |
---|---|
<12/26> 성능고도화 Rac11g (0) | 2015.12.26 |
<12/24> MySQL APM 연동 설치 (0) | 2015.12.24 |
<12/23> 성능고도화 발표 (0) | 2015.12.23 |
<12/22> SQL Tuning 7장 8장 (0) | 2015.12.22 |