[20:10:58][root@#localhost ~]# rpm -qa|grep mariadb
[20:10:59]mariadb-libs-5.5.52-1.el7.x86_64
[20:11:07][root@#localhost ~]# rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64
[20:11:19][root@#localhost ~]# rpm -qa|grep mysql
[20:14:32][root@#localhost ~]# mkdir /data
[20:22:32][root@#localhost ~]# wget http://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm
[20:22:33]--2019-03-2120:22:35-- http://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm
[20:22:33]Resolving repo.mysql.com(repo.mysql.com)...184.28.21.124[20:22:33]Connecting to repo.mysql.com(repo.mysql.com)|184.28.21.124|:80... connected.[20:22:33]HTTP request sent, awaiting response...200OK[20:22:33]Length:25680(25K)[application/x-redhat-package-manager][20:22:33]Saving to: ‘mysql57-community-release-el7-11.noarch.rpm’
[20:22:33][20:22:33]100%[======================================>]25,68068.5KB/s in0.4s
[20:22:33][20:22:33]2019-03-2120:22:35(68.5KB/s)- ‘mysql57-community-release-el7-11.noarch.rpm’ saved [25680/25680][20:23:15][root@#localhost ~]# rpm -ivh mysql57-community-release-el7-11.noarch.rpm
[20:23:15]warning: mysql57-community-release-el7-11.noarch.rpm: Header V3DSA/SHA1 Signature, key ID5072e1f5:NOKEY[20:23:15]Preparing... ################################# [100%][20:23:15]Updating / installing...[20:23:15]1:mysql57-community-release-el7-11 ################################# [100%][20:24:13][root@#localhost ~]# yum install mysql-server
[20:24:13]Loaded plugins: fastestmirror, langpacks
[20:24:14]mysql-connectors-community |2.5 kB 00:00[20:24:14]mysql-tools-community |2.5 kB 00:00[20:24:14]mysql57-community |2.5 kB 00:00[20:24:15](1/3): mysql-connectors-community/x86_64/primary_db |37 kB 00:00[20:24:15](2/3): mysql-tools-community/x86_64/primary_db |54 kB 00:01[20:24:16](3/3): mysql57-community/x86_64/primary_db |170 kB 00:01[20:24:16]Loading mirror speeds from cached hostfile
[20:24:19]* base: mirrors.cqu.edu.cn
[20:24:19]* extras: mirrors.cqu.edu.cn
[20:24:19]* updates: mirrors.cqu.edu.cn
[20:24:19]Resolving Dependencies
[20:24:19]--> Running transaction check
[20:24:19]---> Package mysql-community-server.x86_64 0:5.7.25-1.el7 will be installed
[20:24:19]--> Processing Dependency: mysql-community-common(x86-64)=5.7.25-1.el7 forpackage: mysql-community-server-5.7.25-1.el7.x86_64
[20:24:24]--> Processing Dependency: mysql-community-client(x86-64)>=5.7.9forpackage: mysql-community-server-5.7.25-1.el7.x86_64
[20:24:24]--> Running transaction check
[20:24:24]---> Package mysql-community-client.x86_64 0:5.7.25-1.el7 will be installed
[20:24:24]--> Processing Dependency: mysql-community-libs(x86-64)>=5.7.9forpackage: mysql-community-client-5.7.25-1.el7.x86_64
[20:24:24]---> Package mysql-community-common.x86_64 0:5.7.25-1.el7 will be installed
[20:24:24]--> Running transaction check
[20:24:24]---> Package mysql-community-libs.x86_64 0:5.7.25-1.el7 will be installed
[20:24:25]--> Finished Dependency Resolution
[20:24:25][20:24:25]Dependencies Resolved
[20:24:25][20:24:25]================================================================================[20:24:25] Package Arch Version Repository Size
[20:24:25]================================================================================[20:24:25]Installing:[20:24:25] mysql-community-server x86_64 5.7.25-1.el7 mysql57-community 165M[20:24:25]Installing for dependencies:[20:24:25] mysql-community-client x86_64 5.7.25-1.el7 mysql57-community 24M[20:24:25] mysql-community-common x86_64 5.7.25-1.el7 mysql57-community 274 k
[20:24:25] mysql-community-libs x86_64 5.7.25-1.el7 mysql57-community 2.2M[20:24:25][20:24:25]Transaction Summary
[20:24:25]================================================================================[20:24:25]Install 1Package(+3 Dependent packages)[20:24:25][20:24:25]Total download size:192M[20:24:25]Installed size:863M[20:24:47]Is this ok [y/d/N]: y
[20:24:47]Downloading packages:[20:24:49]warning:/var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.25-1.el7.x86_64.rpm: Header V3DSA/SHA1 Signature, key ID5072e1f5:NOKEY[20:24:49]Public key for mysql-community-common-5.7.25-1.el7.x86_64.rpm is not installed
[20:24:49](1/4): mysql-community-common-5.7.25-1.el7.x86_64.rpm |274 kB 00:02[20:24:53](2/4): mysql-community-libs-5.7.25-1.el7.x86_64.rpm |2.2MB00:03[20:25:11](3/4): mysql-community-client-5.7.25-1.el7.x86_64.rpm |24MB00:00:24[20:27:55](4/4): mysql-community-server-5.7.25-1.el7.x86_64.rpm |165MB00:03:02[20:27:55]------------------------------------------------------------------------------------------------[20:27:55]Total 1.0MB/s |192MB00:03:08[20:27:55]Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql[20:27:55]Importing GPG key 0x5072E1F5:[20:27:55] Userid :"MySQL Release Engineering <[email protected]>"[20:27:55] Fingerprint: a4a9 406876fc bd3c 456770c8 8c71 8d3b 5072 e1f5
[20:27:55] Package : mysql57-community-release-el7-11.noarch(installed)[20:27:55] From :/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[20:28:00]Is this ok [y/N]: y
[20:28:00]Running transaction check
[20:28:00]Running transaction test
[20:28:00]Transaction test succeeded
[20:28:01]Running transaction
[20:28:01]Warning:RPMDB altered outside of yum.[20:28:01]** Found 5 pre-existing rpmdb problem(s),'yum check' output follows:[20:28:01]ipa-client-4.4.0-12.el7.centos.x86_64 has installed conflicts freeipa-client: ipa-client-4.4.0-12.el7.centos.x86_64
[20:28:01]ipa-client-common-4.4.0-12.el7.centos.noarch has installed conflicts freeipa-client-common: ipa-client-common-4.4.0-12.el7.centos.noarch
[20:28:01]ipa-common-4.4.0-12.el7.centos.noarch has installed conflicts freeipa-common: ipa-common-4.4.0-12.el7.centos.noarch
[20:28:01]2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)[20:28:01]2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)[20:28:02] Installing : mysql-community-common-5.7.25-1.el7.x86_64 1/4[20:28:02] Installing : mysql-community-libs-5.7.25-1.el7.x86_64 2/4[20:28:07] Installing : mysql-community-client-5.7.25-1.el7.x86_64 3/4[20:28:38] Installing : mysql-community-server-5.7.25-1.el7.x86_64 4/4[20:28:39] Verifying : mysql-community-common-5.7.25-1.el7.x86_64 1/4[20:28:39] Verifying : mysql-community-libs-5.7.25-1.el7.x86_64 2/4[20:28:39] Verifying : mysql-community-client-5.7.25-1.el7.x86_64 3/4[20:28:39] Verifying : mysql-community-server-5.7.25-1.el7.x86_64 4/4[20:28:39][20:28:39]Installed:[20:28:39] mysql-community-server.x86_64 0:5.7.25-1.el7
[20:28:39][20:28:39]Dependency Installed:[20:28:39] mysql-community-client.x86_64 0:5.7.25-1.el7 mysql-community-common.x86_64 0:5.7.25-1.el7
[20:28:39] mysql-community-libs.x86_64 0:5.7.25-1.el7
[20:28:39][20:28:39]Complete![20:29:12][root@#localhost ~]# cat /etc/my.cnf
[20:29:12]# For advice on how to change settings please see
[20:29:12]# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[20:29:12][20:29:12][mysqld][20:29:12]#
[20:29:12]# Remove leading # and set to the amount ofRAMfor the most important data
[20:29:12]# cache in MySQL. Start at 70%of total RAMfor dedicated server,else10%.[20:29:12]# innodb_buffer_pool_size =128M
[20:29:12]#
[20:29:12]# Remove leading # to turn on a very important data integrity option: logging
[20:29:12]# changes to the binary log between backups.[20:29:12]# log_bin
[20:29:12]#
[20:29:12]# Remove leading # to set options mainly useful for reporting servers.[20:29:12]# The server defaults are faster for transactions and fast SELECTs.[20:29:12]# Adjust sizes as needed, experiment to find the optimal values.[20:29:12]# join_buffer_size =128M
[20:29:12]# sort_buffer_size =2M
[20:29:12]# read_rnd_buffer_size =2M
[20:29:12]datadir=/var/lib/mysql
[20:29:12]socket=/var/lib/mysql/mysql.sock
[20:29:12][20:29:12]# Disabling symbolic-links is recommended to prevent assorted security risks
[20:29:12]symbolic-links=0[20:29:12][20:29:12]log-error=/var/log/mysqld.log
[20:29:12]pid-file=/var/run/mysqld/mysqld.pid
[20:30:41][root@#localhost ~]# service mysqld status
[20:30:41]Redirecting to /bin/systemctl status mysqld.service
[20:30:41]● mysqld.service - MySQL Server
[20:30:41] Loaded:loaded(/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)[20:30:41] Active:inactive(dead)[20:30:41] Docs: man:mysqld(8)[20:30:41] http://dev.mysql.com/doc/refman/en/using-systemd.html
[20:30:52][root@#localhost ~]# service mysqld start
[20:30:52]Redirecting to /bin/systemctl start mysqld.service
[20:31:23][root@#localhost ~]# grep "password"/var/log/mysqld.log
[20:31:23]2019-03-21T12:31:07.638261Z 1[Note]A temporary password is generated for root@localhost: QChl.QsN9IrY
[20:31:40][root@#localhost ~]# mysql -uroot -p
[20:32:09]Enter password:[20:32:09]Welcome to the MySQL monitor. Commands end with; or \g.[20:32:09]Your MySQL connection id is 2[20:32:09]Server version:5.7.25[20:32:09][20:32:09]Copyright(c)2000,2019, Oracle and/or its affiliates. All rights reserved.[20:32:09][20:32:09]Oracle is a registered trademark of Oracle Corporation and/or its
[20:32:09]affiliates. Other names may be trademarks of their respective
[20:32:09]owners.[20:32:09][20:32:09]Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.[20:32:09][20:32:57]mysql> alter user 'root'@'localhost' identified by 'you_password'; # 字母大小写,数字,符号都要!
[20:32:57]Query OK,0 rows affected(0.00 sec)[20:32:57][20:33:13]mysql> quit;[20:33:13]Bye
[20:33:30][root@#localhost ~]# service mysqld restart
[20:33:30]Redirecting to /bin/systemctl restart mysqld.service
[20:33:58][root@#localhost ~]# mysql -uroot -p
[20:34:04]Enter password:[20:34:04]Welcome to the MySQL monitor. Commands end with; or \g.[20:34:04]Your MySQL connection id is 2[20:34:04]Server version:5.7.25 MySQL Community Server(GPL)[20:34:04][20:34:04]Copyright(c)2000,2019, Oracle and/or its affiliates. All rights reserved.[20:34:04][20:34:04]Oracle is a registered trademark of Oracle Corporation and/or its
[20:34:04]affiliates. Other names may be trademarks of their respective
[20:34:04]owners.[20:34:04][20:34:04]Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.[20:34:04][20:34:12]mysql> show databases;[20:34:12]+--------------------+[20:34:12]| Database |[20:34:12]+--------------------+[20:34:12]| information_schema |[20:34:12]| mysql |[20:34:12]| performance_schema |[20:34:12]| sys |[20:34:12]+--------------------+[20:34:12]4 rows inset(0.00 sec)[20:34:12][20:34:18]mysql> quit;[20:34:18]Bye