토요일, 9월 14, 2024
HomeLinuxubuntu mysql manual install

ubuntu mysql manual install

ubuntu MYSQL manual install

1. 필요 패키지 설치
apt-get install libaio1

2.그룹 및 사용자 추가
groupadd mysql
useradd -r -g mysql mysql

3.필요 폴더 생성
mkdir -p /server

4.mysql 다운로드
아래의 URL로 다운로드 안될시http://dev.mysql.com/downloads/mysql/클릭후 Select Platform:Linux – Generic 선택후
Linux – Generic (glibc 2.5) (x86, 64-bit), Compressed TAR Archive 다운로드하면 됩니다.
Linux OS bot 확인 : getconf LONG_BIT

cd /server
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
tar zxf mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz

ln -s mysql-5.6.23-linux-glibc2.5-x86_64 mysql

cd mysql

chown -R mysql .
chgrp -R mysql .

5. init DB 설정
scripts/mysql_install_db –user=mysql

..............
2015-02-13 14:12:07 1392 [Note] InnoDB: Starting shutdown...
2015-02-13 14:12:09 1392 [Note] InnoDB: Shutdown completed; log sequence number 1625987
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 at http://bugs.mysql.com/

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

New default config file was created as ./my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

6. 권한 설정변경
chown -R root .
chown -R mysql data

7. my.cnf 환경설정

echo "basedir=/server/mysql" >> my.cnf
echo "datadir=/server/mysql/data" >> my.cnf
echo "port=3306" >> my.cnf
echo "tmpdir=/tmp" >> my.cnf

7.mysql 서버 시작


bin/mysqld_safe --user=mysql &

[1] 1431
root@ubuntu:/server/mysql# 150213 14:17:56 mysqld_safe Logging to '/server/mysql/data/ubuntu.err'.
150213 14:17:56 mysqld_safe Starting mysqld daemon with databases from /server/mysql/data

8.mysql 버전확인

bin/mysqladmin version

bin/mysqladmin  Ver 8.42 Distrib 5.6.23, for linux-glibc2.5 on x86_64
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version          5.6.23
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /tmp/mysql.sock
Uptime:                 53 sec

Threads: 1  Questions: 2  Slow queries: 0  Opens: 67  Flush tables: 1  Open tables: 60  Queries per second avg: 0.037

9.root 암호설정

mysqladmin -uroot password "mysqlpassword"
Warning: Using a password on the command line interface can be insecure.

10.접속확인

mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.23 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

11./etc/init.d 등록

cp support-files/mysql.server /etc/init.d/mysqld

12.vi /etc/init.d/mysqld 수정
46 basedir=
47 datadir=
아래와 같이 수정

basedir=/server/mysql
datadir=/server/mysql/data

13.구동 프로그램으로 등록

update-rc.d mysqld defaults

14.시작 종료 테스트

service mysqld start          
Starting MySQL
 * 
service mysqld stop
Shutting down MySQL
.. * 

15.PATH 설정

echo "export PATH=$PATH:/server/mysql/bin:" >> /etc/profile
source /etc/profile

참조 URL : http://dev.mysql.com/doc/refman/5.6/en/binary-installation.html

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular