반응형

1.my.cnf 설정

 

1-1)신규생성
- 시스템 매모리가 4G 이상일 때 : my-innodb-heavy-4G.cnf
- 시스템 매모리가 1G~2G 일 때 : my-huge.cnf
- 시스템 매모리가 512MB 정도 일 때 : my-large.cnf
- 시스템 매모리가 32M~64M 이상일 때 : my-medium.cnf
- 시스템 매모리가 64M 이하일 때 : my-small.cnf

 

 cp /usr/local/mysql/support-files/my-innodb-heavy-4G.cnf /etc/my.cnf

 

/etc/my-innodb-heavy-4G.cnf

my-innodb-heavy-4G.cnf

 

1-2) 기존 쓰는 my.cnf가 있을 때(my.cnf 파일만 가져와서 복사)

 cp -rp /home/mysql/my.cnf /etc/my.cnf

 

2. mysql 설치

#su 권한 

[root@~]# /home/mysql/mysqldb_bin/mysqld --defaults-file=/etc/my.cnf --initialize-insecure --user=mysql

 

#시작 스크립트 등록
[root@~]# cp -rp /home/mysql/mysqldb_bin/support-files/mysql.server ../bin
[root@~]# ln -s /home/mysql/mysqldb_bin/bin/mysql.server /etc/init.d/mysqld

 

#DB server 시작

[root@~]# service mysqld start
Starting MySQL...                                          [  OK  ]

 

#Mysql 보안설정

[root@~]# cd /home/mysql/mysqldb_bin/bin
[root@~]# ./mysql_secure_installation --basedir=/home/mysql/mysqldb_bin --socket=/tmp/mysql.sock

 

...
패스워드 입력 후
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : N

... skipping.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.

- Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success..

 

#path 잡기귀찮으면 자주쓰는 것 때려넣는다.

[root@~]# cd /home/mysql/mysqldb_bin/bin

[root@~]# cp my_print_defaults mysql mysql_config mysqladmin mysqlbinlog mysqlcheck mysqldump mysqlimport mysqlshow mysqlslap /usr/bin

[root@~]#cd /usr/bin
[root@~]# chown -Rf root.root my_print_defaults mysql mysql_config mysqladmin mysqlbinlog mysqlcheck mysqldump mysqlimport mysqlshow mysqlslap

 

[root@~]# service mysqld stop

 

#mysql계정으로 접속

[mysql@~]$ service mysqld start
Starting MySQL...                                          [  OK  ]

 

3. mysql shell 접속

 [mysql@~]$ mysql -uroot -p

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.7.27-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, 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>

 

 

 

반응형

'RDB > mysql' 카테고리의 다른 글

mysql shell script 2  (0) 2019.09.09
Mysql shell script 1  (0) 2019.09.09
Xtrabackup 2.49 설치  (0) 2019.09.06
varchar 255가 넘는 인덱스 추가  (0) 2019.09.05
mysql 5.7 binary 설치 2  (0) 2019.08.28
블로그 이미지

dung beetle

취미는 데이터 수집 직업은 MYSQL과 함께 일하는 DBA의 소소한 일상 이야기

,