mysql57 使用

####### yum repository install #######

mysql yum repo http://repo.mysql.com

wget http://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm

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

yum repolist all | grep mysql

####### mysql install #######

yum install mysql-community-server

systemctl start mysqld

systemctl enable mysqld

####### find password and login #######

grep 'temporary password' /var/log/mysqld.log

mysql -uroot -p

####### password update #######

alter user 'root'@'localhost' identified by '+P4ssword+';

or

set password for 'root'@'localhost'=password('+P4ssword+');

####### add user and grant privileges #######

create user 'myroot'@'%' identified by '+P4ssword+';

grant all privileges on *.* to 'myroot'@'%';

flush privileges;

or

grant select on *.* to 'myreader'@'%' identified by '+P4ssword+';

flush privileges;

####### my.cnf #######

[mysqld]

innodb_buffer_pool_size=512M

collation-server=utf8mb4_general_ci

init-connect='SET NAMES utf8mb4'

character-set-server=utf8mb4

skip-character-set-client-handshake

sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

bind-address=0.0.0.0

max_connections=500

[client]

default-character-set=utf8mb4

[mysql]

default-character-set=utf8mb4

systemctl restart mysqld

猜你喜欢

转载自www.cnblogs.com/xiayudashan/p/9585773.html
57