[database] mysql57-server 설치

FreeBSD10 mysql57-server install 

 

root@bsd10:~ # whereis mysql57-server
mysql57-server: /usr/ports/databases/mysql57-server
root@bsd10:~ # cd /usr/ports/databases/mysql57-server && make install clean

 

OK 선택 하여 설치를 진행 합니다.

설치완료후 메세지

*****************************************************************************

Remember to run mysql_upgrade the first time you start the MySQL server
after an upgrade from an earlier version.

Initial password for first time use of MySQL is saved in $HOME/.mysql_secret
ie. when you want to use "mysql -u root -p" first you should see password
in /root/.mysql_secret

MySQL57 has a default %%ETCDIR%%/my.cnf,
remember to replace it wit your own
or set `mysql_optfile="$YOUR_CNF_FILE` in rc.conf.

*****************************************************************************

===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/lib/mysql/plugin/mysqlx.so
/usr/local/lib/mysql/plugin/group_replication.so
/usr/local/libexec/mysqld

      This port has installed the following startup scripts which may cause
      these network services to be started at boot time.
/usr/local/etc/rc.d/mysql-server

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
http://www.mysql.com/
root@bsd10:/usr/ports/databases/mysql57-server #

 

DB 디렉토리 생성

root@bsd10:~ # mkdir /mysql
root@bsd10:~ # chown -R mysql:mysql /mysql

 

/etc/rc.conf 수정

root@bsd10:~ # vi /etc/rc.conf
mysql_enable="YES"
mysql_dbdir="/mysql"

 

my.cnf  수정

root@bsd10:~ # vi /usr/local/etc/mysql/my.cnf
[client]
port                            = 3306
socket                          = /tmp/mysql.sock
default-character-set = utf8

[mysqld]
user                            = mysql
port                            = 3306
socket                          = /tmp/mysql.sock
bind-address                    = 127.0.0.1
basedir                         = /usr/local
#datadir                         = /var/db/mysql
datadir                         = /mysql

character-set-server=utf8
skip-character-set-client-handshake

 

mysql-server 구동및 동작확인

root@bsd10:~ # service mysql-server start
Starting mysql.
root@bsd10:~ #
root@bsd10:~ # sockstat -4|grep -i mysql
mysql    mysqld     69144 23 tcp4   127.0.0.1:3306        *:*
root@bsd10:~ #

 

mysql-server 설정

root@bsd10:~ # /usr/local/bin/mysql_secure_installation
mysql_secure_installation: [ERROR] unknown variable 'default-character-set=utf8'

Securing the MySQL server deployment.

Connecting to MySQL server using password in '/root/.mysql_secret'

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: no
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password:

Re-enter new password:
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) : y
Success.

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.

All done!
root@bsd10:~ #

 

패스워드 변경 및 locale 확인

root@bsd10:~ # mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.20-log

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.

root@localhost [(none)]> SET PASSWORD FOR root@localhost=password('password');
Query OK, 0 rows affected, 1 warning (0.00 sec)

root@localhost [(none)]> quit;
Bye
root@bsd10:~ # mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.20-log Source distribution

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.

root@localhost [(none)]> status;
--------------
mysql  Ver 14.14 Distrib 5.7.20, for FreeBSD10.4 (amd64) using  EditLine wrapper

Connection id:          8
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          more
Using outfile:          ''
Using delimiter:        ;
Server version:         5.7.20-log Source distribution
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /tmp/mysql.sock
Uptime:                 3 min 48 sec

Threads: 1  Questions: 30  Slow queries: 0  Opens: 117  Flush tables: 1  Open ta                                                                                                                                                                                               bles: 111  Queries per second avg: 0.131
--------------

root@localhost [(none)]> quit;
Bye
root@bsd10:~ #

 

cacti 권장 my.cnf 값

character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
skip-character-set-client-handshake
max_heap_table_size             = 200M
tmp_table_size                  = 64M
join_buffer_size                = 64M
innodb_doublewrite              = OFF
innodb_flush_log_at_timeout     = 3
innodb_read_io_threads          = 32
innodb_write_io_threads         = 16

 

댓글 남기기