CentOS6 Mysql5.7 setup

古いDBからのアップデートでした。といっても古いデータは要らないのでなにも考えずに消して進みます。

必要な人はバックアップをしましょう。「だから、いったじゃん!」となります。

# service mysqld start
MySQL データベースを初期化中: [ OK ]
Installing validate password plugin: [ OK ]
mysqld を起動中: [ OK ]

初期パスワードは/var/logmysqld.logの中です。

# grep pass /var/log/mysqld.log
2017-05-11T13:45:31.769158Z 1 [Note] A temporary password is generated for root@localhost: DzgqrD6_&uTB
2017-05-11T13:46:04.938917Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.b3PZwY.sql' started.
2017-05-11T13:46:05.112381Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.b3PZwY.sql' ended.
2017-05-11T13:46:06.694863Z 0 [Note] Shutting down plugin 'sha256_password'
2017-05-11T13:46:06.694877Z 0 [Note] Shutting down plugin 'mysql_native_password'
# mysql_secure_installation

The 'validate_password' plugin is installed on the server.

The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.

Estimated strength of the password: 100

Securing the MySQL server deployment.
Enter password for user root:
The existing password for the user account root has expired. Please set a new password.
New password: ★新しいパスワードを入れる。簡単なものははじかれてしまいます。面倒な人はNEWパスワードを/var/log/mysqld.logのものと同じものを入れてしまいましょう。あとでどこかに強度を落とす方法を張っておきます。
Re-enter new password:

The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.

Estimated strength of the password: 100
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) : 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.

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!

そしてタイムゾーンの設定1
# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
Enter password:
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.

そしてタイムゾーンの設定2+α

# vi /etc/my.cnf
[mysqld] ★ここの配下
default-time-zone = 'Asia/Tokyo' ★この行を追加
character-set-server=utf8
default-storage-engine=InnoDB
innodb_file_per_table
[mysql]
default-character-set=utf8

mysqlを再起動

# service mysqld restart
mysqld を停止中:                                           [  OK  ]
mysqld を起動中:                                           [  OK  ]

そのあと、cacti-1.1.19を入れるときに設定で苦労したので追記(2017-12-01)

# vi /etc/my.cnf
[mysqld]
default-time-zone = 'Asia/Tokyo'
default-storage-engine=InnoDB
innodb_file_per_table
character_set_server=utf8mb4
# cactiの 推奨値
max_heap_table_size=50M
max_allowed_packet=16777216
join_buffer_size=64M
innodb_buffer_pool_size=244M
innodb_doublewrite=OFF
innodb_flush_log_at_timeout=3
innodb_read_io_threads=32
innodb_write_io_threads=16
tmp_table_size=64M
collation_server=utf8mb4_unicode_ci

[mysql]
default-character-set=utf8mb4