Recently, a project will be deployed on Ali Cloud. For the convenience of the development team, I bought an ECS at my own expense and installed a database for development.

Because before are installed in the real machine, and the ali cloud deployment than up, or a little different.

Mysql 1 Install the Mysql version package

wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

yum install mysql57-community-release-el7-11.noarch.rpm

vim /etc/yum.repos.d/mysql-community.repo

Set enable for 5.6 to 1 and 0 for 5.7

2 Installing mysql:

yum install mysql mysql-community-server -y

Create a slow query log file, if not installed will report an error

touch /var/log/slow.log

Grant this file to the mysql user

chown mysql:mysql slow.log

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — – configuration file — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

[mysql]

default-character-set=utf8 socket=/var/lib/mysql/mysql.sock

[mysqld]

innodb_buffer_pool_size = 512M

datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock

autocommit = 1

slow_query_log = on slow_query_log_file =/var/log/slow.log long_query_time = 5

[mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — – configuration file — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Innodb_buffer_pool_size parameter is very important in actual production. It must be increased to 70%-80% of memory. We suffered losses before.

3 error

[ERROR] Can’t open the mysql.plugin table. Please run mysql_upgrade to create it.

Go to the usr directory

./mysql_install_db –user=mysql

4 Startup Commands

systemctl status mysqld.service

Systemctl enable mysqld.service Starts upon startup

Systemctl start mysqld.service Starts the mysql service

Systemctl restart mysqld.service Restarts the mysql service

systemctl stop mysqld.service

5 Initial login Settings

mysql_secure_installation

Set root password? [Y/n] Specifies whether to set the password of user root

Remove anonymous users? [Y/n] Indicates whether to delete anonymous users

Disallow root login remotely? [Y/n] Specifies whether to disable root remote login

Remove test database and access to it? [Y/n] Indicates whether to delete database

Reload privilege tables now? [Y/n] Indicates whether to reload authorization information

GRANT ALL PRIVILEGES ON. TO ‘PRIVILEGES ‘@’%’ identified by’ password ‘;