思い出したように CentOS7 に MySQL5.7 をインストールした

yum remove mysql-server mysql-libs mysql-devel mysql*
rm -rf /var/lib/mysql/
yum -y install https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community
yum -y install mysql mysql-devel mysql-server
yum -y install mysql mysql-utilities
yum -y install postfix

systemctl enable mysqld.service
systemctl start mysqld.service
systemctl status mysqld.service

# rootの初期パスワード
cat /var/log/mysqld.log | grep 'password is generated'


mysql_secure_installation

# cnfの編集
vim /etc/my.cnf

# rootの初期パスワード
mysql -uroot -p
  • /etc/my.cnf
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

# ↓追加
validate-password=OFF
log-slow-admin-statements = 1
log-queries-not-using-indexes = 1
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 0.5
expire_logs_days = 14

easyramble.com

rootにパスワードなしで入る

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set authentication_string=password('') where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

stackoverflow.com