Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
7
Help us understand the problem. What is going on with this article?
@i2bskn

MySQLインストール

More than 5 years have passed since last update.

MySQLインストール

バイナリをdev.mysql.comからdownloadして/usr/local/srcに配置しておく。

ユーザ作成

groupadd -g 2008 mysql
useradd -u 2008 -g mysql -d /home/mysql -m -s /bin/bash mysql

必要なパッケージのインストール

apt-get -y install libncurses5-dev libaio-dev zlib1g-dev libreadline-dev

配置

cd /usr/local/src
tar zxvf mysql-5.6.19-linux-glibc2.5-x86_64.tar.gz
mv -i mysql-5.6.19-linux-glibc2.5-x86_64 /usr/local/.
ln -s /usr/local/mysql-5.6.19-linux-glibc2.5-x86_64 /usr/local/mysql
chown -R mysql. /usr/local/mysql/data

初期化

cd /usr/local/mysql
scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data

設定

mkdir -p /var/run/mysql
mkdir etc
cp -pi support-files/my-default.cnf etc/my.cnf

設定値はその時々で。

/usr/local/etc/my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8

[mysqld]
# Global
datadir = /usr/local/mysql/data
tmpdir = /var/tmp
port = 3306
socket = /tmp/mysql.sock
user=mysql

max_connections = 16
max_allowed_packet = 1M

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

query_cache_size = 0
query_cache_type = 0

table_open_cache = 128
table_definition_cache = 512
open_files_limit = 5000

innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 16M
innodb_log_buffer_size = 8M
key_buffer_size = 16M

# Session
sort_buffer_size = 512K
read_rnd_buffer_size = 512K
join_buffer_size = 256K
read_buffer_size = 256K

# Log
log-bin = mysql-bin
binlog_format = mixed
max_binlog_size = 128M
expire_logs_days = 7
server-id = 1
#general_log_file = /tmp/query.log
general_log = 0
slow_query_log = 0
#long_query_time = 0.5
#log_queries_not_using_indexes
#log_output = TABLE
innodb_log_file_size = 128M

[mysqldump]
quick
set-charset
single-transaction
max_allowed_packet = 16M

起動

cp -pi support-files/mysql.server /etc/init.d/mysql
/etc/init.d/mysql start
bin/mysqladmin -u root password 'secret'
bin/mysql_secure_installation
7
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
7
Help us understand the problem. What is going on with this article?