版权声明:本文为博主原创文章,转载请注明出处 https://blog.csdn.net/vkingnew/article/details/89493224
# wget https://repo.mysql.com//mysql80-community-release-el7-2.noarch.rpm
#rpm -ivh mysql80-community-release-el7-2.noarch.rpm
# cat /etc/yum.repos.d/mysql-community.repo
...
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
...
# yum -y install mysql-community-client mysql-community-common mysql-community-devel mysql-community-libs \n
mysql-community-libs-compat mysql-community-server
参数文件的配置:
# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
default-storage-engine=InnoDB
character_set_server= utf8mb4
character-set-client-handshake = FALSE
character-set-server= utf8mb4
collation-server= utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
lower_case_table_names= 1
plugin-load=validate_password.so
validate-password=OFF
explicit_defaults_for_timestamp=true
server-id=100
log-bin=mysql_bin.log
binlog_format=ROW
expire-logs-days=2
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
启动MySQL数据库:
# systemctl restart mysqld
[root@datanode2 ~]# cat /var/log/mysqld.log | grep -i password
2019-04-24T06:58:04.636266Z 1 [Note] A temporary password is generated for root@localhost: h3zQ;O7se2N5
2019-04-24T06:58:08.158194Z 0 [Note] Plugin 'validate_password' is disabled.
2019-04-24T06:58:08.165199Z 0 [ERROR] Function 'validate_password' already exists
2019-04-24T06:58:08.165224Z 0 [Warning] Couldn't load plugin named 'validate_password' with soname 'validate_password.so'.
[root@datanode2 ~]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.25-log
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
-- 账号设置:
mysql> grant all privileges on *.* to root@'%' identified by 'oracle';
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user root@'localhost' identified by 'oracle';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to root@'%' identified by 'oracle';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)